go-errhttp/methodnotallowed.go

47 lines
877 B
Go
Raw Normal View History

2017-02-06 20:58:13 +00:00
package errhttp
import (
"net/http"
)
var _ Error = internalMethodNotAllowed{}
var _ ClientError = internalMethodNotAllowed{}
var _ MethodNotAllowed = internalMethodNotAllowed{}
var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil)
2017-02-06 20:58:13 +00:00
type MethodNotAllowed interface {
ClientError
MethodNotAllowed()
}
type internalMethodNotAllowed struct {
err error
}
func MethodNotAllowedWrap(err error) error {
return internalMethodNotAllowed{
err:err,
}
}
func (receiver internalMethodNotAllowed) Error() string {
return receiver.err.Error()
}
func (internalMethodNotAllowed) ErrHTTP() int {
return http.StatusMethodNotAllowed
}
2017-02-06 20:58:13 +00:00
func (internalMethodNotAllowed) ClientError() {
// Nothing here.
}
func (internalMethodNotAllowed) MethodNotAllowed() {
// Nothing here.
}
func (receiver internalMethodNotAllowed) Unwrap() error {
return receiver.err
}