modified package-level global errors in the way the new error package Unwrap(), etc understands it

master
Charles Iliya Krempeaux 2023-08-14 05:30:30 -07:00
parent 502ea33a84
commit 34675d3edc
40 changed files with 40 additions and 200 deletions

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalBadGateway{} var _ Error = internalBadGateway{}
var _ BadGateway = internalBadGateway{} var _ BadGateway = internalBadGateway{}
var ErrBadGateway error = BadGatewayWrap(errors.New("Bad Gateway")) var ErrBadGateway error = BadGatewayWrap(nil)
type BadGateway interface { type BadGateway interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalBadRequest{} var _ Error = internalBadRequest{}
var _ BadRequest = internalBadRequest{} var _ BadRequest = internalBadRequest{}
var ErrBadRequest = BadRequestWrap(errors.New("Bad Request")) var ErrBadRequest = BadRequestWrap(nil)
type BadRequest interface { type BadRequest interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalConflict{} var _ Error = internalConflict{}
var _ Conflict = internalConflict{} var _ Conflict = internalConflict{}
var ErrConflict = ConflictWrap(errors.New("Conflict")) var ErrConflict = ConflictWrap(nil)
type Conflict interface { type Conflict interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalExpectationFailed{} var _ Error = internalExpectationFailed{}
var _ ExpectationFailed = internalExpectationFailed{} var _ ExpectationFailed = internalExpectationFailed{}
var ErrExpectationFailed error = ExpectationFailedWrap(errors.New("Expectation Failed")) var ErrExpectationFailed error = ExpectationFailedWrap(nil)
type ExpectationFailed interface { type ExpectationFailed interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalFailedDependency{} var _ Error = internalFailedDependency{}
var _ FailedDependency = internalFailedDependency{} var _ FailedDependency = internalFailedDependency{}
var ErrFailedDependency error = FailedDependencyWrap(errors.New("Failed Dependency")) var ErrFailedDependency error = FailedDependencyWrap(nil)
type FailedDependency interface { type FailedDependency interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalForbidden{} var _ Error = internalForbidden{}
var _ Forbidden = internalForbidden{} var _ Forbidden = internalForbidden{}
var ErrForbidden error = ForbiddenWrap(errors.New("Forbidden")) var ErrForbidden error = ForbiddenWrap(nil)
type Forbidden interface { type Forbidden interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalGatewayTimeout{} var _ Error = internalGatewayTimeout{}
var _ GatewayTimeout = internalGatewayTimeout{} var _ GatewayTimeout = internalGatewayTimeout{}
var ErrGatewayTimeout error = GatewayTimeoutWrap(errors.New("Gateway Timeout")) var ErrGatewayTimeout error = GatewayTimeoutWrap(nil)
type GatewayTimeout interface { type GatewayTimeout interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalGone{} var _ Error = internalGone{}
var _ Gone = internalGone{} var _ Gone = internalGone{}
var ErrGone error = GoneWrap(errors.New("Gone")) var ErrGone error = GoneWrap(nil)
type Gone interface { type Gone interface {
ClientError() ClientError()

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalHTTPVersionNotSupported{} var _ Error = internalHTTPVersionNotSupported{}
var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{} var _ HTTPVersionNotSupported = internalHTTPVersionNotSupported{}
var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(errors.New("HTTP Version Not Supported")) var ErrHTTPVersionNotSupported error = HTTPVersionNotSupportedWrap(nil)
type HTTPVersionNotSupported interface { type HTTPVersionNotSupported interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalInsufficientStorage{} var _ Error = internalInsufficientStorage{}
var _ InsufficientStorage = internalInsufficientStorage{} var _ InsufficientStorage = internalInsufficientStorage{}
var ErrInsufficientStorage error = InsufficientStorageWrap(errors.New("Insufficient Storage")) var ErrInsufficientStorage error = InsufficientStorageWrap(nil)
type InsufficientStorage interface { type InsufficientStorage interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalInternalServerError{} var _ Error = internalInternalServerError{}
var _ InternalServerError = internalInternalServerError{} var _ InternalServerError = internalInternalServerError{}
var ErrInternalServerError error = InternalServerErrorWrap(errors.New("Internal Server Error")) var ErrInternalServerError error = InternalServerErrorWrap(nil)
type InternalServerError interface { type InternalServerError interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalLengthRequired{} var _ Error = internalLengthRequired{}
var _ LengthRequired = internalLengthRequired{} var _ LengthRequired = internalLengthRequired{}
var ErrLengthRequired error = LengthRequiredWrap(errors.New("Length Required")) var ErrLengthRequired error = LengthRequiredWrap(nil)
type LengthRequired interface { type LengthRequired interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalLocked{} var _ Error = internalLocked{}
var _ Locked = internalLocked{} var _ Locked = internalLocked{}
var ErrLocked error = LockedWrap(errors.New("Locked")) var ErrLocked error = LockedWrap(nil)
type Locked interface { type Locked interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalLoopDetected{} var _ Error = internalLoopDetected{}
var _ LoopDetected = internalLoopDetected{} var _ LoopDetected = internalLoopDetected{}
var ErrLoopDetected error = LoopDetectedWrap(errors.New("Loop Detected")) var ErrLoopDetected error = LoopDetectedWrap(nil)
type LoopDetected interface { type LoopDetected interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalMethodNotAllowed{} var _ Error = internalMethodNotAllowed{}
var _ MethodNotAllowed = internalMethodNotAllowed{} var _ MethodNotAllowed = internalMethodNotAllowed{}
var ErrMethodNotAllowed error = MethodNotAllowedWrap(errors.New("Method Not Allowed")) var ErrMethodNotAllowed error = MethodNotAllowedWrap(nil)
type MethodNotAllowed interface { type MethodNotAllowed interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalNetworkAuthenticationRequired{} var _ Error = internalNetworkAuthenticationRequired{}
var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{} var _ NetworkAuthenticationRequired = internalNetworkAuthenticationRequired{}
var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(errors.New("Network Authentication Required")) var ErrNetworkAuthenticationRequired error = NetworkAuthenticationRequiredWrap(nil)
type NetworkAuthenticationRequired interface { type NetworkAuthenticationRequired interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalNotAcceptable{} var _ Error = internalNotAcceptable{}
var _ NotAcceptable = internalNotAcceptable{} var _ NotAcceptable = internalNotAcceptable{}
var ErrNotAcceptable error = NotAcceptableWrap(errors.New("Not Acceptable")) var ErrNotAcceptable error = NotAcceptableWrap(nil)
type NotAcceptable interface { type NotAcceptable interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalNotExtended{} var _ Error = internalNotExtended{}
var _ NotExtended = internalNotExtended{} var _ NotExtended = internalNotExtended{}
var ErrNotExtended error = NotExtendedWrap(errors.New("Not Extended")) var ErrNotExtended error = NotExtendedWrap(nil)
type NotExtended interface { type NotExtended interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalNotFound{} var _ Error = internalNotFound{}
var _ NotFound = internalNotFound{} var _ NotFound = internalNotFound{}
var ErrNotFound error = NotFoundWrap(errors.New("Not Found")) var ErrNotFound error = NotFoundWrap(nil)
type NotFound interface { type NotFound interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalNotImplemented{} var _ Error = internalNotImplemented{}
var _ NotImplemented = internalNotImplemented{} var _ NotImplemented = internalNotImplemented{}
var ErrNotImplemented error = NotImplementedWrap(errors.New("Not Implemented")) var ErrNotImplemented error = NotImplementedWrap(nil)
type NotImplemented interface { type NotImplemented interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalPayloadTooLarge{} var _ Error = internalPayloadTooLarge{}
var _ PayloadTooLarge = internalPayloadTooLarge{} var _ PayloadTooLarge = internalPayloadTooLarge{}
var ErrPayloadTooLarge error = PayloadTooLargeWrap(errors.New("Payload Too Large")) var ErrPayloadTooLarge error = PayloadTooLargeWrap(nil)
type PayloadTooLarge interface { type PayloadTooLarge interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalPaymentRequired{} var _ Error = internalPaymentRequired{}
var _ PaymentRequired = internalPaymentRequired{} var _ PaymentRequired = internalPaymentRequired{}
var ErrPaymentRequired error = PaymentRequiredWrap(errors.New("Payment Required")) var ErrPaymentRequired error = PaymentRequiredWrap(nil)
type PaymentRequired interface { type PaymentRequired interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalPreconditionFailed{} var _ Error = internalPreconditionFailed{}
var _ PreconditionFailed = internalPreconditionFailed{} var _ PreconditionFailed = internalPreconditionFailed{}
var ErrPreconditionFailed error = PreconditionFailedWrap(errors.New("Precondition Failed")) var ErrPreconditionFailed error = PreconditionFailedWrap(nil)
type PreconditionFailed interface { type PreconditionFailed interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalPreconditionRequired{} var _ Error = internalPreconditionRequired{}
var _ PreconditionRequired = internalPreconditionRequired{} var _ PreconditionRequired = internalPreconditionRequired{}
var ErrPreconditionRequired error = PreconditionRequiredWrap(errors.New("Precondition Required")) var ErrPreconditionRequired error = PreconditionRequiredWrap(nil)
type PreconditionRequired interface { type PreconditionRequired interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalProxyAuthRequired{} var _ Error = internalProxyAuthRequired{}
var _ ProxyAuthRequired = internalProxyAuthRequired{} var _ ProxyAuthRequired = internalProxyAuthRequired{}
var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(errors.New("Proxy Auth Required")) var ErrProxyAuthRequired error = ProxyAuthRequiredWrap(nil)
type ProxyAuthRequired interface { type ProxyAuthRequired interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalRequestedRangeNotSatisfiable{} var _ Error = internalRequestedRangeNotSatisfiable{}
var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{} var _ RequestedRangeNotSatisfiable = internalRequestedRangeNotSatisfiable{}
var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(errors.New("Requested Range Not Satisfiable")) var ErrRequestedRangeNotSatisfiable error = RequestedRangeNotSatisfiableWrap(nil)
type RequestedRangeNotSatisfiable interface { type RequestedRangeNotSatisfiable interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalRequestEntityTooLarge{} var _ Error = internalRequestEntityTooLarge{}
var _ RequestEntityTooLarge = internalRequestEntityTooLarge{} var _ RequestEntityTooLarge = internalRequestEntityTooLarge{}
var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(errors.New("Request Entity Too Large")) var ErrRequestEntityTooLarge error = RequestEntityTooLargeWrap(nil)
type RequestEntityTooLarge interface { type RequestEntityTooLarge interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalRequestHeaderFieldsTooLarge{} var _ Error = internalRequestHeaderFieldsTooLarge{}
var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{} var _ RequestHeaderFieldsTooLarge = internalRequestHeaderFieldsTooLarge{}
var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(errors.New("RequestHeaderFieldsTooLarge")) var ErrRequestHeaderFieldsTooLarge error = RequestHeaderFieldsTooLargeWrap(nil)
type RequestHeaderFieldsTooLarge interface { type RequestHeaderFieldsTooLarge interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalRequestTimeout{} var _ Error = internalRequestTimeout{}
var _ RequestTimeout = internalRequestTimeout{} var _ RequestTimeout = internalRequestTimeout{}
var ErrRequestTimeout error = RequestTimeoutWrap(errors.New("Request Timeout")) var ErrRequestTimeout error = RequestTimeoutWrap(nil)
type RequestTimeout interface { type RequestTimeout interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalRequestURITooLong{} var _ Error = internalRequestURITooLong{}
var _ RequestURITooLong = internalRequestURITooLong{} var _ RequestURITooLong = internalRequestURITooLong{}
var ErrRequestURITooLong error = RequestURITooLongWrap(errors.New("Request URI Too Long")) var ErrRequestURITooLong error = RequestURITooLongWrap(nil)
type RequestURITooLong interface { type RequestURITooLong interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalServiceUnavailable{} var _ Error = internalServiceUnavailable{}
var _ ServiceUnavailable = internalServiceUnavailable{} var _ ServiceUnavailable = internalServiceUnavailable{}
var ErrServiceUnavailable error = ServiceUnavailableWrap(errors.New("Service Unavailable")) var ErrServiceUnavailable error = ServiceUnavailableWrap(nil)
type ServiceUnavailable interface { type ServiceUnavailable interface {
ServerError ServerError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalTeapot{} var _ Error = internalTeapot{}
var _ Teapot = internalTeapot{} var _ Teapot = internalTeapot{}
var ErrTeapot error = TeapotWrap(errors.New("I'm a teapot")) var ErrTeapot error = TeapotWrap(nil)
type Teapot interface { type Teapot interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalTooManyRequests{} var _ Error = internalTooManyRequests{}
var _ TooManyRequests = internalTooManyRequests{} var _ TooManyRequests = internalTooManyRequests{}
var ErrTooManyRequests error = TooManyRequestsWrap(errors.New("Too Many Requests")) var ErrTooManyRequests error = TooManyRequestsWrap(nil)
type TooManyRequests interface { type TooManyRequests interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalUnauthorized{} var _ Error = internalUnauthorized{}
var _ Unauthorized = internalUnauthorized{} var _ Unauthorized = internalUnauthorized{}
var ErrUnauthorized error = UnauthorizedWrap(errors.New("Unauthorized")) var ErrUnauthorized error = UnauthorizedWrap(nil)
type Unauthorized interface { type Unauthorized interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalUnavailableForLegalReasons{} var _ Error = internalUnavailableForLegalReasons{}
var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{} var _ UnavailableForLegalReasons = internalUnavailableForLegalReasons{}
var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(errors.New("Unavailable For Legal Reasons")) var ErrUnavailableForLegalReasons error = UnavailableForLegalReasonsWrap(nil)
type UnavailableForLegalReasons interface { type UnavailableForLegalReasons interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalUnprocessableEntity{} var _ Error = internalUnprocessableEntity{}
var _ UnprocessableEntity = internalUnprocessableEntity{} var _ UnprocessableEntity = internalUnprocessableEntity{}
var ErrUnprocessableEntity error = UnprocessableEntityWrap(errors.New("Unprocessable Entity")) var ErrUnprocessableEntity error = UnprocessableEntityWrap(nil)
type UnprocessableEntity interface { type UnprocessableEntity interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalUnsupportedMediaType{} var _ Error = internalUnsupportedMediaType{}
var _ UnsupportedMediaType = internalUnsupportedMediaType{} var _ UnsupportedMediaType = internalUnsupportedMediaType{}
var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(errors.New("Unsupported Media Type")) var ErrUnsupportedMediaType error = UnsupportedMediaTypeWrap(nil)
type UnsupportedMediaType interface { type UnsupportedMediaType interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalUpgradeRequired{} var _ Error = internalUpgradeRequired{}
var _ UpgradeRequired = internalUpgradeRequired{} var _ UpgradeRequired = internalUpgradeRequired{}
var ErrUpgradeRequired error = UpgradeRequiredWrap(errors.New("Upgrade Required")) var ErrUpgradeRequired error = UpgradeRequiredWrap(nil)
type UpgradeRequired interface { type UpgradeRequired interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalURITooLong{} var _ Error = internalURITooLong{}
var _ URITooLong = internalURITooLong{} var _ URITooLong = internalURITooLong{}
var ErrURITooLong error = URITooLongWrap(errors.New("URI Too Long")) var ErrURITooLong error = URITooLongWrap(nil)
type URITooLong interface { type URITooLong interface {
ClientError ClientError

View File

@ -1,13 +1,9 @@
package errhttp package errhttp
import (
"errors"
)
var _ Error = internalVariantAlsoNegotiates{} var _ Error = internalVariantAlsoNegotiates{}
var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{} var _ VariantAlsoNegotiates = internalVariantAlsoNegotiates{}
var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(errors.New("Variant Also Negotiates")) var ErrVariantAlsoNegotiates error = VariantAlsoNegotiatesWrap(nil)
type VariantAlsoNegotiates interface { type VariantAlsoNegotiates interface {
ServerError ServerError