go-errhttp/internalservererror.go

49 lines
908 B
Go
Raw Normal View History

2017-02-06 21:14:15 +00:00
package errhttp
import (
"errors"
)
var ErrInternalServerError error = InternalServerErrorWrap(errors.New("Internal Server Error"))
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 {
return receiver.err.Error()
}
func (receiver internalInternalServerError) Err() error {
return receiver.err
}
func (internalInternalServerError) ErrHTTP() {
// Nothing here.
}
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
}