Documentation
¶
Overview ¶
Package errhttp provides types errors that make dealing with HTTP response errors easier.
Example
import "github.com/reiver/go-errhttp"
// ...
if err := something(); nil != err {
return errhttp.BadRequestWrap(err)
}
// ...
switch err.(type) {
case errhttp.BadRequest:
//@TODO
case errhttp.NotFound:
//@TODO
case errhttp.InternalServerError:
//@TODO
case errhttp.ClientError:
//@TODO
case errhttp.ServerError:
//@TODO
default:
//@TODO
}
Index ¶
- func BadGatewayWrap(err error) error
- func BadRequestWrap(err error) error
- func ConflictWrap(err error) error
- func ExpectationFailedWrap(err error) error
- func FailedDependencyWrap(err error) error
- func ForbiddenWrap(err error) error
- func GatewayTimeoutWrap(err error) error
- func GoneWrap(err error) error
- func HTTPVersionNotSupportedWrap(err error) error
- func InsufficientStorageWrap(err error) error
- func InternalServerErrorWrap(err error) error
- func LengthRequiredWrap(err error) error
- func LockedWrap(err error) error
- func LoopDetectedWrap(err error) error
- func MethodNotAllowedWrap(err error) error
- func NetworkAuthenticationRequiredWrap(err error) error
- func NotAcceptableWrap(err error) error
- func NotExtendedWrap(err error) error
- func NotFoundWrap(err error) error
- func NotImplementedWrap(err error) error
- func PayloadTooLargeWrap(err error) error
- func PaymentRequiredWrap(err error) error
- func PreconditionFailedWrap(err error) error
- func PreconditionRequiredWrap(err error) error
- func ProxyAuthRequiredWrap(err error) error
- func RequestEntityTooLargeWrap(err error) error
- func RequestHeaderFieldsTooLargeWrap(err error) error
- func RequestTimeoutWrap(err error) error
- func RequestURITooLongWrap(err error) error
- func RequestedRangeNotSatisfiableWrap(err error) error
- func ServiceUnavailableWrap(err error) error
- func TeapotWrap(err error) error
- func TooManyRequestsWrap(err error) error
- func URITooLongWrap(err error) error
- func UnauthorizedWrap(err error) error
- func UnavailableForLegalReasonsWrap(err error) error
- func UnprocessableEntityWrap(err error) error
- func UnsupportedMediaTypeWrap(err error) error
- func UpgradeRequiredWrap(err error) error
- func VariantAlsoNegotiatesWrap(err error) error
- type BadGateway
- type BadRequest
- type ClientError
- type Conflict
- type Error
- type ExpectationFailed
- type FailedDependency
- type Forbidden
- type GatewayTimeout
- type Gone
- type HTTPVersionNotSupported
- type InsufficientStorage
- type InternalServerError
- type LengthRequired
- type Locked
- type LoopDetected
- type MethodNotAllowed
- type NetworkAuthenticationRequired
- type NotAcceptable
- type NotExtended
- type NotFound
- type NotImplemented
- type PayloadTooLarge
- type PaymentRequired
- type PreconditionFailed
- type PreconditionRequired
- type ProxyAuthRequired
- type RequestEntityTooLarge
- type RequestHeaderFieldsTooLarge
- type RequestTimeout
- type RequestURITooLong
- type RequestedRangeNotSatisfiable
- type ServerError
- type ServiceUnavailable
- type Teapot
- type TooManyRequests
- type URITooLong
- type Unauthorized
- type UnavailableForLegalReasons
- type UnprocessableEntity
- type UnsupportedMediaType
- type UpgradeRequired
- type VariantAlsoNegotiates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadGatewayWrap ¶
func BadRequestWrap ¶
func ConflictWrap ¶
func ExpectationFailedWrap ¶
func FailedDependencyWrap ¶
func ForbiddenWrap ¶
func GatewayTimeoutWrap ¶
func InsufficientStorageWrap ¶
func InternalServerErrorWrap ¶
func LengthRequiredWrap ¶
func LockedWrap ¶
func LoopDetectedWrap ¶
func MethodNotAllowedWrap ¶
func NotAcceptableWrap ¶
func NotExtendedWrap ¶
func NotFoundWrap ¶
func NotImplementedWrap ¶
func PayloadTooLargeWrap ¶ added in v1.1.0
func PaymentRequiredWrap ¶
func PreconditionFailedWrap ¶
func ProxyAuthRequiredWrap ¶
func RequestTimeoutWrap ¶
func RequestURITooLongWrap ¶
func ServiceUnavailableWrap ¶
func TeapotWrap ¶
func TooManyRequestsWrap ¶
func URITooLongWrap ¶ added in v1.1.0
func UnauthorizedWrap ¶
func UnprocessableEntityWrap ¶
func UpgradeRequiredWrap ¶
Types ¶
type BadGateway ¶
type BadGateway interface {
ServerError
BadGateway()
}
type BadRequest ¶
type BadRequest interface {
ClientError
BadRequest()
}
type ClientError ¶
type ClientError interface {
Error
ClientError()
}
type Conflict ¶
type Conflict interface {
ClientError
Conflict()
}
type ExpectationFailed ¶
type ExpectationFailed interface {
ClientError
ExpectationFailed()
}
type FailedDependency ¶
type FailedDependency interface {
ClientError
FailedDependency()
}
type Forbidden ¶
type Forbidden interface {
ClientError
Forbidden()
}
type GatewayTimeout ¶
type GatewayTimeout interface {
ServerError
GatewayTimeout()
}
type HTTPVersionNotSupported ¶
type HTTPVersionNotSupported interface {
ServerError
HTTPVersionNotSupported()
}
type InsufficientStorage ¶
type InsufficientStorage interface {
ServerError
InsufficientStorage()
}
type InternalServerError ¶
type InternalServerError interface {
ServerError
InternalServerError()
}
type LengthRequired ¶
type LengthRequired interface {
ClientError
LengthRequired()
}
type Locked ¶
type Locked interface {
ClientError
Locked()
}
type LoopDetected ¶
type LoopDetected interface {
ServerError
LoopDetected()
}
type MethodNotAllowed ¶
type MethodNotAllowed interface {
ClientError
MethodNotAllowed()
}
type NetworkAuthenticationRequired ¶
type NetworkAuthenticationRequired interface {
ServerError
NetworkAuthenticationRequired()
}
type NotAcceptable ¶
type NotAcceptable interface {
ClientError
NotAcceptable()
}
type NotExtended ¶
type NotExtended interface {
ServerError
NotExtended()
}
type NotFound ¶
type NotFound interface {
ClientError
NotFound()
}
type NotImplemented ¶
type NotImplemented interface {
ServerError
NotImplemented()
}
type PayloadTooLarge ¶ added in v1.1.0
type PayloadTooLarge interface {
ClientError
PayloadTooLarge()
}
type PaymentRequired ¶
type PaymentRequired interface {
ClientError
PaymentRequired()
}
type PreconditionFailed ¶
type PreconditionFailed interface {
ClientError
PreconditionFailed()
}
type PreconditionRequired ¶
type PreconditionRequired interface {
ClientError
PreconditionRequired()
}
type ProxyAuthRequired ¶
type ProxyAuthRequired interface {
ClientError
ProxyAuthRequired()
}
type RequestEntityTooLarge ¶
type RequestEntityTooLarge interface {
ClientError
RequestEntityTooLarge()
}
type RequestTimeout ¶
type RequestURITooLong ¶
type RequestedRangeNotSatisfiable ¶
type RequestedRangeNotSatisfiable interface {
ClientError
RequestedRangeNotSatisfiable()
}
type ServerError ¶
type ServerError interface {
Error
ServerError()
}
type ServiceUnavailable ¶
type ServiceUnavailable interface {
ServerError
}
type Teapot ¶
type Teapot interface {
ClientError
Teapot()
}
type TooManyRequests ¶
type TooManyRequests interface {
ClientError
TooManyRequests()
}
type URITooLong ¶ added in v1.1.0
type URITooLong interface {
ClientError
URITooLong()
}
type Unauthorized ¶
type Unauthorized interface {
ClientError
}
type UnavailableForLegalReasons ¶
type UnavailableForLegalReasons interface {
ClientError
}
type UnprocessableEntity ¶
type UnprocessableEntity interface {
ClientError
UnprocessableEntity()
}
type UnsupportedMediaType ¶
type UnsupportedMediaType interface {
ClientError
UnsupportedMediaType()
}
type UpgradeRequired ¶
type UpgradeRequired interface {
ClientError
UpgradeRequired()
}
type VariantAlsoNegotiates ¶
type VariantAlsoNegotiates interface {
ServerError
VariantAlsoNegotiates()
}
Source Files
¶
- badgateway.go
- badrequest.go
- clienterror.go
- conflict.go
- doc.go
- error.go
- expectationfailed.go
- faileddependency.go
- forbidden.go
- gatewaytimeout.go
- gone.go
- httpversionnotsupported.go
- insufficientstorage.go
- internalservererror.go
- lengthrequired.go
- locked.go
- loopdetected.go
- methodnotallowed.go
- networkauthenticationrequired.go
- notacceptable.go
- notextended.go
- notfound.go
- notimplemented.go
- payloadtoolarge.go
- paymentrequired.go
- preconditionfailed.go
- preconditionrequired.go
- proxyauthrequired.go
- requestedrangenotsatisfiable.go
- requestentitytoolarge.go
- requestheaderfieldstoolarge.go
- requesttimeout.go
- requesturitoolong.go
- servererror.go
- serviceunavailable.go
- teapot.go
- toomanyrequests.go
- unauthorized.go
- unavailableforlegalreasons.go
- unprocessableentity.go
- unsupportedmediatype.go
- upgraderequired.go
- uritoolong.go
- variantaisonegotiates.go
Click to show internal directories.
Click to hide internal directories.