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
import (
"errors"
)
var _ Error = internalBadGateway{}
var _ BadGateway = internalBadGateway{}
var ErrBadGateway error = BadGatewayWrap(errors.New("Bad Gateway"))
var ErrBadGateway error = BadGatewayWrap(nil)
type BadGateway interface {
ServerError

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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