go-errhttp/forbidden.go

47 lines
743 B
Go

package errhttp
import (
"net/http"
)
var _ Error = internalForbidden{}
var _ ClientError = internalForbidden{}
var _ Forbidden = internalForbidden{}
var ErrForbidden error = ForbiddenWrap(nil)
type Forbidden interface {
ClientError
Forbidden()
}
type internalForbidden struct {
err error
}
func ForbiddenWrap(err error) error {
return internalForbidden{
err:err,
}
}
func (receiver internalForbidden) Error() string {
return receiver.err.Error()
}
func (internalForbidden) ErrHTTP() int {
return http.StatusForbidden
}
func (internalForbidden) ClientError() {
// Nothing here.
}
func (internalForbidden) Forbidden() {
// Nothing here.
}
func (receiver internalForbidden) Unwrap() error {
return receiver.err
}