added .ErrHTTP() method so can detect these are these type of errors
parent
bbaaf21002
commit
593a440c11
|
@ -31,6 +31,10 @@ func (receiver internalBadGateway) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadGateway) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalBadGateway) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalBadRequest) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalBadRequest) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalBadRequest) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalConflict) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalConflict) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalConflict) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
1
error.go
1
error.go
|
@ -3,5 +3,6 @@ package errhttp
|
|||
type Error interface {
|
||||
error
|
||||
Err() error
|
||||
ErrHTTP()
|
||||
Unwrap() error
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalExpectationFailed) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalExpectationFailed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalFailedDependency) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalFailedDependency) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalFailedDependency) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalForbidden) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalForbidden) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalForbidden) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalGatewayTimeout) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalGatewayTimeout) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
4
gone.go
4
gone.go
|
@ -29,6 +29,10 @@ func (receiver internalGone) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalGone) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalGone) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalHTTPVersionNotSupported) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalHTTPVersionNotSupported) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalInsufficientStorage) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalInsufficientStorage) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalInternalServerError) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalInternalServerError) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalInternalServerError) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalLengthRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLengthRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLengthRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalLocked) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLocked) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLocked) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalLoopDetected) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalLoopDetected) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalLoopDetected) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalMethodNotAllowed) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalMethodNotAllowed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalNetworkAuthenticationRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNetworkAuthenticationRequired) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalNotAcceptable) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotAcceptable) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalNotExtended) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotExtended) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotExtended) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalNotFound ) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotFound ) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotFound ) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalNotImplemented) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalNotImplemented) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalNotImplemented) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalPayloadTooLarge) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPayloadTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPayloadTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,11 @@ func (receiver internalPaymentRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPaymentRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
|
||||
func (internalPaymentRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalPreconditionFailed) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPreconditionFailed) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalPreconditionRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalPreconditionRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalProxyAuthRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalProxyAuthRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalRequestedRangeNotSatisfiable) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestedRangeNotSatisfiable) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalRequestEntityTooLarge) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestEntityTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ func (receiver internalRequestHeaderFieldsTooLarge) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestHeaderFieldsTooLarge) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ func (receiver internalRequestTimeout) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestTimeout) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestTimeout) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -30,6 +30,10 @@ func (receiver internalRequestURITooLong) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalRequestURITooLong) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalServiceUnavailable) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalServiceUnavailable) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalTeapot) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTeapot) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalTeapot) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalTooManyRequests) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalTooManyRequests) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalUnauthorized) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnauthorized) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnauthorized) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalUnavailableForLegalReasons) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnavailableForLegalReasons) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalUnprocessableEntity) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnprocessableEntity) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalUnsupportedMediaType) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUnsupportedMediaType) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalUpgradeRequired) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalUpgradeRequired) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalUpgradeRequired) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -29,6 +29,10 @@ func (receiver internalURITooLong) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalURITooLong) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalURITooLong) ClientError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ func (receiver internalVariantAlsoNegotiates) Err() error {
|
|||
return receiver.err
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) ErrHTTP() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
||||
func (internalVariantAlsoNegotiates) ServerError() {
|
||||
// Nothing here.
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue