added .ErrHTTP() method so can detect these are these type of errors

master
Charles Iliya Krempeaux 2023-02-16 12:01:00 -08:00
parent bbaaf21002
commit 593a440c11
41 changed files with 162 additions and 0 deletions

View File

@ -31,6 +31,10 @@ func (receiver internalBadGateway) Err() error {
return receiver.err return receiver.err
} }
func (internalBadGateway) ErrHTTP() {
// Nothing here.
}
func (internalBadGateway) ServerError() { func (internalBadGateway) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalBadRequest) Err() error {
return receiver.err return receiver.err
} }
func (internalBadRequest) ErrHTTP() {
// Nothing here.
}
func (internalBadRequest) ClientError() { func (internalBadRequest) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalConflict) Err() error {
return receiver.err return receiver.err
} }
func (internalConflict) ErrHTTP() {
// Nothing here.
}
func (internalConflict) ClientError() { func (internalConflict) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -3,5 +3,6 @@ package errhttp
type Error interface { type Error interface {
error error
Err() error Err() error
ErrHTTP()
Unwrap() error Unwrap() error
} }

View File

@ -29,6 +29,10 @@ func (receiver internalExpectationFailed) Err() error {
return receiver.err return receiver.err
} }
func (internalExpectationFailed) ErrHTTP() {
// Nothing here.
}
func (internalExpectationFailed) ClientError() { func (internalExpectationFailed) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalFailedDependency) Err() error {
return receiver.err return receiver.err
} }
func (internalFailedDependency) ErrHTTP() {
// Nothing here.
}
func (internalFailedDependency) ClientError() { func (internalFailedDependency) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalForbidden) Err() error {
return receiver.err return receiver.err
} }
func (internalForbidden) ErrHTTP() {
// Nothing here.
}
func (internalForbidden) ClientError() { func (internalForbidden) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalGatewayTimeout) Err() error {
return receiver.err return receiver.err
} }
func (internalGatewayTimeout) ErrHTTP() {
// Nothing here.
}
func (internalGatewayTimeout) ServerError() { func (internalGatewayTimeout) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalGone) Err() error {
return receiver.err return receiver.err
} }
func (internalGone) ErrHTTP() {
// Nothing here.
}
func (internalGone) ClientError() { func (internalGone) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalHTTPVersionNotSupported) Err() error {
return receiver.err return receiver.err
} }
func (internalHTTPVersionNotSupported) ErrHTTP() {
// Nothing here.
}
func (internalHTTPVersionNotSupported) ServerError() { func (internalHTTPVersionNotSupported) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalInsufficientStorage) Err() error {
return receiver.err return receiver.err
} }
func (internalInsufficientStorage) ErrHTTP() {
// Nothing here.
}
func (internalInsufficientStorage) ServerError() { func (internalInsufficientStorage) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalInternalServerError) Err() error {
return receiver.err return receiver.err
} }
func (internalInternalServerError) ErrHTTP() {
// Nothing here.
}
func (internalInternalServerError) ServerError() { func (internalInternalServerError) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalLengthRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalLengthRequired) ErrHTTP() {
// Nothing here.
}
func (internalLengthRequired) ClientError() { func (internalLengthRequired) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalLocked) Err() error {
return receiver.err return receiver.err
} }
func (internalLocked) ErrHTTP() {
// Nothing here.
}
func (internalLocked) ClientError() { func (internalLocked) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalLoopDetected) Err() error {
return receiver.err return receiver.err
} }
func (internalLoopDetected) ErrHTTP() {
// Nothing here.
}
func (internalLoopDetected) ServerError() { func (internalLoopDetected) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalMethodNotAllowed) Err() error {
return receiver.err return receiver.err
} }
func (internalMethodNotAllowed) ErrHTTP() {
// Nothing here.
}
func (internalMethodNotAllowed) ClientError() { func (internalMethodNotAllowed) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalNetworkAuthenticationRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalNetworkAuthenticationRequired) ErrHTTP() {
// Nothing here.
}
func (internalNetworkAuthenticationRequired) ServerError() { func (internalNetworkAuthenticationRequired) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalNotAcceptable) Err() error {
return receiver.err return receiver.err
} }
func (internalNotAcceptable) ErrHTTP() {
// Nothing here.
}
func (internalNotAcceptable) ClientError() { func (internalNotAcceptable) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalNotExtended) Err() error {
return receiver.err return receiver.err
} }
func (internalNotExtended) ErrHTTP() {
// Nothing here.
}
func (internalNotExtended) ServerError() { func (internalNotExtended) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalNotFound ) Err() error {
return receiver.err return receiver.err
} }
func (internalNotFound ) ErrHTTP() {
// Nothing here.
}
func (internalNotFound ) ClientError() { func (internalNotFound ) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalNotImplemented) Err() error {
return receiver.err return receiver.err
} }
func (internalNotImplemented) ErrHTTP() {
// Nothing here.
}
func (internalNotImplemented) ServerError() { func (internalNotImplemented) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalPayloadTooLarge) Err() error {
return receiver.err return receiver.err
} }
func (internalPayloadTooLarge) ErrHTTP() {
// Nothing here.
}
func (internalPayloadTooLarge) ClientError() { func (internalPayloadTooLarge) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,11 @@ func (receiver internalPaymentRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalPaymentRequired) ErrHTTP() {
// Nothing here.
}
func (internalPaymentRequired) ClientError() { func (internalPaymentRequired) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalPreconditionFailed) Err() error {
return receiver.err return receiver.err
} }
func (internalPreconditionFailed) ErrHTTP() {
// Nothing here.
}
func (internalPreconditionFailed) ClientError() { func (internalPreconditionFailed) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalPreconditionRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalPreconditionRequired) ErrHTTP() {
// Nothing here.
}
func (internalPreconditionRequired) ClientError() { func (internalPreconditionRequired) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalProxyAuthRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalProxyAuthRequired) ErrHTTP() {
// Nothing here.
}
func (internalProxyAuthRequired) ClientError() { func (internalProxyAuthRequired) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalRequestedRangeNotSatisfiable) Err() error {
return receiver.err return receiver.err
} }
func (internalRequestedRangeNotSatisfiable) ErrHTTP() {
// Nothing here.
}
func (internalRequestedRangeNotSatisfiable) ClientError() { func (internalRequestedRangeNotSatisfiable) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalRequestEntityTooLarge) Err() error {
return receiver.err return receiver.err
} }
func (internalRequestEntityTooLarge) ErrHTTP() {
// Nothing here.
}
func (internalRequestEntityTooLarge) ClientError() { func (internalRequestEntityTooLarge) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -30,6 +30,10 @@ func (receiver internalRequestHeaderFieldsTooLarge) Err() error {
return receiver.err return receiver.err
} }
func (internalRequestHeaderFieldsTooLarge) ErrHTTP() {
// Nothing here.
}
func (internalRequestHeaderFieldsTooLarge) ClientError() { func (internalRequestHeaderFieldsTooLarge) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -30,6 +30,10 @@ func (receiver internalRequestTimeout) Err() error {
return receiver.err return receiver.err
} }
func (internalRequestTimeout) ErrHTTP() {
// Nothing here.
}
func (internalRequestTimeout) ClientError() { func (internalRequestTimeout) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -30,6 +30,10 @@ func (receiver internalRequestURITooLong) Err() error {
return receiver.err return receiver.err
} }
func (internalRequestURITooLong) ErrHTTP() {
// Nothing here.
}
func (internalRequestURITooLong) ClientError() { func (internalRequestURITooLong) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalServiceUnavailable) Err() error {
return receiver.err return receiver.err
} }
func (internalServiceUnavailable) ErrHTTP() {
// Nothing here.
}
func (internalServiceUnavailable) ServerError() { func (internalServiceUnavailable) ServerError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalTeapot) Err() error {
return receiver.err return receiver.err
} }
func (internalTeapot) ErrHTTP() {
// Nothing here.
}
func (internalTeapot) ClientError() { func (internalTeapot) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalTooManyRequests) Err() error {
return receiver.err return receiver.err
} }
func (internalTooManyRequests) ErrHTTP() {
// Nothing here.
}
func (internalTooManyRequests) ClientError() { func (internalTooManyRequests) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalUnauthorized) Err() error {
return receiver.err return receiver.err
} }
func (internalUnauthorized) ErrHTTP() {
// Nothing here.
}
func (internalUnauthorized) ClientError() { func (internalUnauthorized) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalUnavailableForLegalReasons) Err() error {
return receiver.err return receiver.err
} }
func (internalUnavailableForLegalReasons) ErrHTTP() {
// Nothing here.
}
func (internalUnavailableForLegalReasons) ClientError() { func (internalUnavailableForLegalReasons) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalUnprocessableEntity) Err() error {
return receiver.err return receiver.err
} }
func (internalUnprocessableEntity) ErrHTTP() {
// Nothing here.
}
func (internalUnprocessableEntity) ClientError() { func (internalUnprocessableEntity) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalUnsupportedMediaType) Err() error {
return receiver.err return receiver.err
} }
func (internalUnsupportedMediaType) ErrHTTP() {
// Nothing here.
}
func (internalUnsupportedMediaType) ClientError() { func (internalUnsupportedMediaType) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalUpgradeRequired) Err() error {
return receiver.err return receiver.err
} }
func (internalUpgradeRequired) ErrHTTP() {
// Nothing here.
}
func (internalUpgradeRequired) ClientError() { func (internalUpgradeRequired) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -29,6 +29,10 @@ func (receiver internalURITooLong) Err() error {
return receiver.err return receiver.err
} }
func (internalURITooLong) ErrHTTP() {
// Nothing here.
}
func (internalURITooLong) ClientError() { func (internalURITooLong) ClientError() {
// Nothing here. // Nothing here.
} }

View File

@ -31,6 +31,10 @@ func (receiver internalVariantAlsoNegotiates) Err() error {
return receiver.err return receiver.err
} }
func (internalVariantAlsoNegotiates) ErrHTTP() {
// Nothing here.
}
func (internalVariantAlsoNegotiates) ServerError() { func (internalVariantAlsoNegotiates) ServerError() {
// Nothing here. // Nothing here.
} }