go-errhttp/requestentitytoolarge.go

53 lines
1.2 KiB
Go
Raw Normal View History

2017-02-06 20:58:13 +00:00
package errhttp
import (
"net/http"
)
var _ Error = internalRequestEntityTooLarge{}
var _ ClientError = internalRequestEntityTooLarge{}
var _ RequestEntityTooLarge = internalRequestEntityTooLarge{}
var ClientErrorRequestEntityTooLarge ClientError = RequestEntityTooLargeWrap(nil).(RequestEntityTooLarge)
var ErrHTTPRequestEntityTooLarge Error = ClientErrorRequestEntityTooLarge
var ErrRequestEntityTooLarge error = ClientErrorRequestEntityTooLarge
2017-02-06 20:58:13 +00:00
type RequestEntityTooLarge interface {
ClientError
RequestEntityTooLarge()
}
type internalRequestEntityTooLarge struct {
err error
}
func RequestEntityTooLargeWrap(err error) error {
return internalRequestEntityTooLarge{
err:err,
}
}
func (receiver internalRequestEntityTooLarge) 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 20:58:13 +00:00
}
func (internalRequestEntityTooLarge) ErrHTTP() int {
return http.StatusRequestEntityTooLarge
}
2017-02-06 20:58:13 +00:00
func (internalRequestEntityTooLarge) ClientError() {
// Nothing here.
}
func (internalRequestEntityTooLarge) RequestEntityTooLarge() {
// Nothing here.
}
func (receiver internalRequestEntityTooLarge) Unwrap() error {
return receiver.err
}