corrected Gone error + created new package global errors

master
Charles Iliya Krempeaux 2023-10-17 22:32:39 -07:00
parent f09738021e
commit d5eea959fb
40 changed files with 118 additions and 43 deletions

View File

@ -8,7 +8,9 @@ var _ Error = internalBadGateway{}
var _ ServerError = internalBadGateway{}
var _ BadGateway = internalBadGateway{}
var ErrBadGateway error = BadGatewayWrap(nil)
var ServerErrorBadGateway ServerError = BadGatewayWrap(nil).(BadGateway)
var ErrHTTPBadGateway Error = ServerErrorBadGateway
var ErrBadGateway error = ServerErrorBadGateway
type BadGateway interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalBadRequest{}
var _ ClientError = internalBadRequest{}
var _ BadRequest = internalBadRequest{}
var ErrBadRequest error = BadRequestWrap(nil)
var ClientErrorBadRequest ClientError = BadRequestWrap(nil).(BadRequest)
var ErrHTTPBadRequest Error = ClientErrorBadRequest
var ErrBadRequest error = ClientErrorBadRequest
type BadRequest interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalConflict{}
var _ ClientError = internalConflict{}
var _ Conflict = internalConflict{}
var ErrConflict error = ConflictWrap(nil)
var ClientErrorConflict ClientError = ConflictWrap(nil).(Conflict)
var ErrHTTPConflict Error = ClientErrorConflict
var ErrConflict error = ClientErrorConflict
type Conflict interface {
ClientError

View File

@ -1,7 +1,5 @@
package errhttp_test
//@TODO: THIS TEST IS GIVING A WEIRD ERROR
/*
import (
"testing"
@ -49,4 +47,3 @@ func TestErrGone(t *testing.T) {
}
}
}
*/

View File

@ -8,7 +8,9 @@ var _ Error = internalExpectationFailed{}
var _ ClientError = internalExpectationFailed{}
var _ ExpectationFailed = internalExpectationFailed{}
var ErrExpectationFailed error = ExpectationFailedWrap(nil)
var ClientErrorExpectationFailed ClientError = ExpectationFailedWrap(nil).(ExpectationFailed)
var ErrHTTPExpectationFailed Error = ClientErrorExpectationFailed
var ErrExpectationFailed error = ClientErrorExpectationFailed
type ExpectationFailed interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalFailedDependency{}
var _ ClientError = internalFailedDependency{}
var _ FailedDependency = internalFailedDependency{}
var ErrFailedDependency error = FailedDependencyWrap(nil)
var ClientErrorFailedDependency ClientError = FailedDependencyWrap(nil).(FailedDependency)
var ErrHTTPFailedDependency Error = ClientErrorFailedDependency
var ErrFailedDependency error = ClientErrorFailedDependency
type FailedDependency interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalForbidden{}
var _ ClientError = internalForbidden{}
var _ Forbidden = internalForbidden{}
var ErrForbidden error = ForbiddenWrap(nil)
var ClientErrorForbidden ClientError = ForbiddenWrap(nil).(Forbidden)
var ErrHTTPForbidden Error = ClientErrorForbidden
var ErrForbidden error = ClientErrorForbidden
type Forbidden interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalGatewayTimeout{}
var _ ServerError = internalGatewayTimeout{}
var _ GatewayTimeout = internalGatewayTimeout{}
var ErrGatewayTimeout error = GatewayTimeoutWrap(nil)
var ServerErrorGatewayTimeout ServerError = GatewayTimeoutWrap(nil).(GatewayTimeout)
var ErrHTTPGatewayTimeout Error = ServerErrorGatewayTimeout
var ErrGatewayTimeout error = ServerErrorGatewayTimeout
type GatewayTimeout interface {
ServerError

View File

@ -8,10 +8,12 @@ var _ Error = internalGone{}
var _ ClientError = internalGone{}
var _ Gone = internalGone{}
var ErrGone error = GoneWrap(nil)
var ClientErrorGone ClientError = GoneWrap(nil).(Gone)
var ErrHTTPGone Error = ClientErrorGone
var ErrGone error = ClientErrorGone
type Gone interface {
ClientError()
ClientError
Gone()
}

View File

@ -8,7 +8,9 @@ var _ Error = internalHTTPVersionNotSupported{}
var _ ServerError = internalHTTPVersionNotSupported{}
var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{}
var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(nil)
var ServerErrorHTTPVersionNotSupported ServerError = HTTPVersionNotSupportedWrap(nil).(HTTPVersionNotSupported)
var ErrHTTPHTTPVersionNotSupported Error = ServerErrorHTTPVersionNotSupported
var ErrHTTPVersionNotSupported error = ServerErrorHTTPVersionNotSupported
type HTTPVersionNotSupported interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalInsufficientStorage{}
var _ ServerError = internalInsufficientStorage{}
var _ InsufficientStorage = internalInsufficientStorage{}
var ErrInsufficientStorage error = InsufficientStorageWrap(nil)
var ServerErrorInsufficientStorage ServerError = InsufficientStorageWrap(nil).(InsufficientStorage)
var ErrHTTPInsufficientStorage Error = ServerErrorInsufficientStorage
var ErrInsufficientStorage error = ServerErrorInsufficientStorage
type InsufficientStorage interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalInternalServerError{}
var _ ServerError = internalInternalServerError{}
var _ InternalServerError = internalInternalServerError{}
var ErrInternalServerError error = InternalServerErrorWrap(nil)
var ServerErrorInternalServerError InternalServerError = InternalServerErrorWrap(nil).(InternalServerError)
var ErrHTTPInternalServerError Error = ServerErrorInternalServerError
var ErrInternalServerError error = ServerErrorInternalServerError
type InternalServerError interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalLengthRequired{}
var _ ClientError = internalLengthRequired{}
var _ LengthRequired = internalLengthRequired{}
var ErrLengthRequired error = LengthRequiredWrap(nil)
var ClientErrorLengthRequired ClientError = LengthRequiredWrap(nil).(LengthRequired)
var ErrHTTPLengthRequired Error = ClientErrorLengthRequired
var ErrLengthRequired error = ClientErrorLengthRequired
type LengthRequired interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalLocked{}
var _ ClientError = internalLocked{}
var _ Locked = internalLocked{}
var ErrLocked error = LockedWrap(nil)
var ClientErrorLocked ClientError = LockedWrap(nil).(Locked)
var ErrHTTPLocked Error = ClientErrorLocked
var ErrLocked error = ClientErrorLocked
type Locked interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalLoopDetected{}
var _ ServerError = internalLoopDetected{}
var _ LoopDetected = internalLoopDetected{}
var ErrLoopDetected error = LoopDetectedWrap(nil)
var ServerErrorLoopDetected ServerError = LoopDetectedWrap(nil).(LoopDetected)
var ErrHTTPLoopDetected Error = ServerErrorLoopDetected
var ErrLoopDetected error = ServerErrorLoopDetected
type LoopDetected interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalMethodNotAllowed{}
var _ ClientError = internalMethodNotAllowed{}
var _ MethodNotAllowed = internalMethodNotAllowed{}
var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil)
var ClientErrorMethodNotAllowed ClientError = MethodNotAllowedWrap(nil).(MethodNotAllowed)
var ErrHTTPMethodNotAllowed Error = ClientErrorMethodNotAllowed
var ErrMethodNotAllowed error = ClientErrorMethodNotAllowed
type MethodNotAllowed interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalMisdirectedRequest{}
var _ ClientError = internalMisdirectedRequest{}
var _ MisdirectedRequest = internalMisdirectedRequest{}
var ErrMisdirectedRequest error = MisdirectedRequestWrap(nil)
var ClientErrorMisdirectedRequest ClientError = MisdirectedRequestWrap(nil).(MisdirectedRequest)
var ErrHTTPMisdirectedRequest Error = ClientErrorMisdirectedRequest
var ErrMisdirectedRequest error = ClientErrorMisdirectedRequest
type MisdirectedRequest interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalNetworkAuthenticationRequired{}
var _ ServerError = internalNetworkAuthenticationRequired{}
var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{}
var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(nil)
var ServerErrorNetworkAuthenticationRequired ServerError = NetworkAuthenticationRequiredWrap(nil).(NetworkAuthenticationRequired)
var ErrHTTPNetworkAuthenticationRequired Error = ServerErrorNetworkAuthenticationRequired
var ErrNetworkAuthenticationRequired error = ServerErrorNetworkAuthenticationRequired
type NetworkAuthenticationRequired interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalNotAcceptable{}
var _ ClientError = internalNotAcceptable{}
var _ NotAcceptable = internalNotAcceptable{}
var ErrNotAcceptable error = NotAcceptableWrap(nil)
var ClientErrorNotAcceptable ClientError = NotAcceptableWrap(nil).(NotAcceptable)
var ErrHTTPNotAcceptable Error = ClientErrorNotAcceptable
var ErrNotAcceptable error = ClientErrorNotAcceptable
type NotAcceptable interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalNotExtended{}
var _ ServerError = internalNotExtended{}
var _ NotExtended = internalNotExtended{}
var ErrNotExtended error = NotExtendedWrap(nil)
var ServerErrorNotExtended ServerError = NotExtendedWrap(nil).(NotExtended)
var ErrHTTPNotExtended Error = ServerErrorNotExtended
var ErrNotExtended error = ServerErrorNotExtended
type NotExtended interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalNotFound{}
var _ ClientError = internalNotFound{}
var _ NotFound = internalNotFound{}
var ErrNotFound error = NotFoundWrap(nil)
var ClientErrorNotFound ClientError = NotFoundWrap(nil).(NotFound)
var ErrHTTPNotFound Error = ClientErrorNotFound
var ErrNotFound error = ClientErrorNotFound
type NotFound interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalNotImplemented{}
var _ ServerError = internalNotImplemented{}
var _ NotImplemented = internalNotImplemented{}
var ErrNotImplemented error = NotImplementedWrap(nil)
var ServerErrorNotImplemented ServerError = NotImplementedWrap(nil).(NotImplemented)
var ErrHTTPNotImplemented Error = ServerErrorNotImplemented
var ErrNotImplemented error = ServerErrorNotImplemented
type NotImplemented interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalPaymentRequired{}
var _ ClientError = internalPaymentRequired{}
var _ PaymentRequired = internalPaymentRequired{}
var ErrPaymentRequired error = PaymentRequiredWrap(nil)
var ClientErrorPaymentRequired ClientError = PaymentRequiredWrap(nil).(PaymentRequired)
var ErrHTTPPaymentRequired Error = ClientErrorPaymentRequired
var ErrPaymentRequired error = ClientErrorPaymentRequired
type PaymentRequired interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalPreconditionFailed{}
var _ ClientError = internalPreconditionFailed{}
var _ PreconditionFailed = internalPreconditionFailed{}
var ErrPreconditionFailed error = PreconditionFailedWrap(nil)
var ClientErrorPreconditionFailed ClientError = PreconditionFailedWrap(nil).(PreconditionFailed)
var ErrHTTPPreconditionFailed Error = ClientErrorPreconditionFailed
var ErrPreconditionFailed error = ClientErrorPreconditionFailed
type PreconditionFailed interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalProxyAuthRequired{}
var _ ClientError = internalProxyAuthRequired{}
var _ ProxyAuthRequired = internalProxyAuthRequired{}
var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(nil)
var ClientErrorProxyAuthRequired ClientError = ProxyAuthRequiredWrap(nil).(ProxyAuthRequired)
var ErrHTTPProxyAuthRequired Error = ClientErrorProxyAuthRequired
var ErrProxyAuthRequired error = ClientErrorProxyAuthRequired
type ProxyAuthRequired interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalRequestedRangeNotSatisfiable{}
var _ ClientError = internalRequestedRangeNotSatisfiable{}
var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{}
var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(nil)
var ClientErrorRequestedRangeNotSatisfiable ClientError = RequestedRangeNotSatisfiableWrap(nil).(RequestedRangeNotSatisfiable)
var ErrHTTPRequestedRangeNotSatisfiable Error = ClientErrorRequestedRangeNotSatisfiable
var ErrRequestedRangeNotSatisfiable error = ClientErrorRequestedRangeNotSatisfiable
type RequestedRangeNotSatisfiable interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalRequestEntityTooLarge{}
var _ ClientError = internalRequestEntityTooLarge{}
var _ RequestEntityTooLarge = internalRequestEntityTooLarge{}
var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(nil)
var ClientErrorRequestEntityTooLarge ClientError = RequestEntityTooLargeWrap(nil).(RequestEntityTooLarge)
var ErrHTTPRequestEntityTooLarge Error = ClientErrorRequestEntityTooLarge
var ErrRequestEntityTooLarge error = ClientErrorRequestEntityTooLarge
type RequestEntityTooLarge interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalRequestHeaderFieldsTooLarge{}
var _ ClientError = internalRequestHeaderFieldsTooLarge{}
var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{}
var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(nil)
var ClientErrorRequestHeaderFieldsTooLarge ClientError = RequestHeaderFieldsTooLargeWrap(nil).(RequestHeaderFieldsTooLarge)
var ErrHTTPRequestHeaderFieldsTooLarge Error = ClientErrorRequestHeaderFieldsTooLarge
var ErrRequestHeaderFieldsTooLarge error = ClientErrorRequestHeaderFieldsTooLarge
type RequestHeaderFieldsTooLarge interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalRequestTimeout{}
var _ ClientError = internalRequestTimeout{}
var _ RequestTimeout = internalRequestTimeout{}
var ErrRequestTimeout error = RequestTimeoutWrap(nil)
var ClientErrorRequestTimeout ClientError = RequestTimeoutWrap(nil).(RequestTimeout)
var ErrHTTPRequestTimeout Error = ClientErrorRequestTimeout
var ErrRequestTimeout error = ClientErrorRequestTimeout
type RequestTimeout interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalRequestURITooLong{}
var _ ClientError = internalRequestURITooLong{}
var _ RequestURITooLong = internalRequestURITooLong{}
var ErrRequestURITooLong error = RequestURITooLongWrap(nil)
var ClientErrorRequestURITooLong ClientError = RequestURITooLongWrap(nil).(RequestURITooLong)
var ErrHTTPRequestURITooLong Error = ClientErrorRequestURITooLong
var ErrRequestURITooLong error = ClientErrorRequestURITooLong
type RequestURITooLong interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalServiceUnavailable{}
var _ ServerError = internalServiceUnavailable{}
var _ ServiceUnavailable = internalServiceUnavailable{}
var ErrServiceUnavailable error = ServiceUnavailableWrap(nil)
var ServerErrorServiceUnavailable ServerError = ServiceUnavailableWrap(nil).(ServiceUnavailable)
var ErrHTTPServiceUnavailable Error = ServerErrorServiceUnavailable
var ErrServiceUnavailable error = ServerErrorServiceUnavailable
type ServiceUnavailable interface {
ServerError

View File

@ -8,7 +8,9 @@ var _ Error = internalTeapot{}
var _ ClientError = internalTeapot{}
var _ Teapot = internalTeapot{}
var ErrTeapot error = TeapotWrap(nil)
var ClientErrorTeapot ClientError = TeapotWrap(nil).(Teapot)
var ErrHTTPTeapot Error = ClientErrorTeapot
var ErrTeapot error = ClientErrorTeapot
type Teapot interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalTooEarly{}
var _ ClientError = internalTooEarly{}
var _ TooEarly = internalTooEarly{}
var ErrTooEarly error = TooEarlyWrap(nil)
var ClientErrorTooEarly ClientError = TooEarlyWrap(nil).(TooEarly)
var ErrHTTPTooEarly Error = ClientErrorTooEarly
var ErrTooEarly error = ClientErrorTooEarly
type TooEarly interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalTooManyRequests{}
var _ ClientError = internalTooManyRequests{}
var _ TooManyRequests = internalTooManyRequests{}
var ErrTooManyRequests error = TooManyRequestsWrap(nil)
var ClientErrorTooManyRequests ClientError = TooManyRequestsWrap(nil).(TooManyRequests)
var ErrHTTPTooManyRequests Error = ClientErrorTooManyRequests
var ErrTooManyRequests error = ClientErrorTooManyRequests
type TooManyRequests interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalUnauthorized{}
var _ ClientError = internalUnauthorized{}
var _ Unauthorized = internalUnauthorized{}
var ErrUnauthorized error = UnauthorizedWrap(nil)
var ClientErrorUnauthorized ClientError = UnauthorizedWrap(nil).(Unauthorized)
var ErrHTTPUnauthorized Error = ClientErrorUnauthorized
var ErrUnauthorized error = ClientErrorUnauthorized
type Unauthorized interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalUnavailableForLegalReasons{}
var _ ClientError = internalUnavailableForLegalReasons{}
var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{}
var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(nil)
var ClientErrorUnavailableForLegalReasons ClientError = UnavailableForLegalReasonsWrap(nil).(UnavailableForLegalReasons)
var ErrHTTPUnavailableForLegalReasons Error = ClientErrorUnavailableForLegalReasons
var ErrUnavailableForLegalReasons error = ClientErrorUnavailableForLegalReasons
type UnavailableForLegalReasons interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalUnprocessableEntity{}
var _ ClientError = internalUnprocessableEntity{}
var _ UnprocessableEntity = internalUnprocessableEntity{}
var ErrUnprocessableEntity error = UnprocessableEntityWrap(nil)
var ClientErrorUnprocessableEntity ClientError = UnprocessableEntityWrap(nil).(UnprocessableEntity)
var ErrHTTPUnprocessableEntity Error = ClientErrorUnprocessableEntity
var ErrUnprocessableEntity error = ClientErrorUnprocessableEntity
type UnprocessableEntity interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalUnsupportedMediaType{}
var _ ClientError = internalUnsupportedMediaType{}
var _ UnsupportedMediaType = internalUnsupportedMediaType{}
var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(nil)
var ClientErrorUnsupportedMediaType ClientError = UnsupportedMediaTypeWrap(nil).(UnsupportedMediaType)
var ErrHTTPUnsupportedMediaType Error = ClientErrorUnsupportedMediaType
var ErrUnsupportedMediaType error = ClientErrorUnsupportedMediaType
type UnsupportedMediaType interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalUpgradeRequired{}
var _ ClientError = internalUpgradeRequired{}
var _ UpgradeRequired = internalUpgradeRequired{}
var ErrUpgradeRequired error = UpgradeRequiredWrap(nil)
var ClientErrorUpgradeRequired ClientError = UpgradeRequiredWrap(nil).(UpgradeRequired)
var ErrHTTPUpgradeRequired Error = ClientErrorUpgradeRequired
var ErrUpgradeRequired error = ClientErrorUpgradeRequired
type UpgradeRequired interface {
ClientError

View File

@ -8,7 +8,9 @@ var _ Error = internalVariantAlsoNegotiates{}
var _ ServerError = internalVariantAlsoNegotiates{}
var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{}
var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(nil)
var ServerErrorVariantAlsoNegotiates ServerError = VariantAlsoNegotiatesWrap(nil).(VariantAlsoNegotiates)
var ErrHTTPVariantAlsoNegotiates Error = ServerErrorVariantAlsoNegotiates
var ErrVariantAlsoNegotiates error = ServerErrorVariantAlsoNegotiates
type VariantAlsoNegotiates interface {
ServerError