go-errhttp/internalservererror.go

55 lines
1.3 KiB
Go
Raw Normal View History

2017-02-06 21:14:15 +00:00
package errhttp
import (
"net/http"
)
var _ Error = internalInternalServerError{}
var _ ServerError = internalInternalServerError{}
var _ InternalServerError = internalInternalServerError{}
var ServerErrorInternalServerError InternalServerError = InternalServerErrorWrap(nil).(InternalServerError)
var ErrHTTPInternalServerError Error = ServerErrorInternalServerError
var ErrInternalServerError error = ServerErrorInternalServerError
2017-02-06 21:14:15 +00:00
type InternalServerError interface {
ServerError
InternalServerError()
}
var _ InternalServerError = internalInternalServerError{}
2017-02-06 21:14:15 +00:00
type internalInternalServerError struct {
err error
}
func InternalServerErrorWrap(err error) error {
return internalInternalServerError{
err:err,
}
}
func (receiver internalInternalServerError) Error() string {
2023-10-01 02:30:28 +00:00
err := receiver.err
if nil == err {
return http.StatusText(receiver.ErrHTTP())
}
return err.Error()
2017-02-06 21:14:15 +00:00
}
func (internalInternalServerError) ErrHTTP() int {
return http.StatusInternalServerError
}
2017-02-06 21:14:15 +00:00
func (internalInternalServerError) ServerError() {
// Nothing here.
}
func (internalInternalServerError) InternalServerError() {
// Nothing here.
}
func (receiver internalInternalServerError) Unwrap() error {
return receiver.err
}