Charles Iliya Krempeaux 1b349fbb21 | ||
---|---|---|
LICENSE | ||
README.md | ||
badgateway.go | ||
badrequest.go | ||
badrequest_test.go | ||
clienterror.go | ||
clienterror_test.go | ||
conflict.go | ||
conflict_test.go | ||
doc.go | ||
error.go | ||
expectationfailed.go | ||
expectationfailed_test.go | ||
faileddependency.go | ||
faileddependency_test.go | ||
forbidden.go | ||
forbidden_test.go | ||
gatewaytimeout.go | ||
gone.go | ||
gone_test.go | ||
httpversionnotsupported.go | ||
insufficientstorage.go | ||
internalservererror.go | ||
lengthrequired.go | ||
lengthrequired_test.go | ||
locked.go | ||
locked_test.go | ||
loopdetected.go | ||
methodnotallowed.go | ||
methodnotallowed_test.go | ||
networkauthenticationrequired.go | ||
notacceptable.go | ||
notacceptable_test.go | ||
notextended.go | ||
notfound.go | ||
notfound_test.go | ||
notimplemented.go | ||
paymentrequired.go | ||
paymentrequired_test.go | ||
preconditionfailed.go | ||
preconditionfailed_test.go | ||
preconditionrequired.go | ||
preconditionrequired_test.go | ||
proxyauthrequired.go | ||
proxyauthrequired_test.go | ||
requestedrangenotsatisfiable.go | ||
requestedrangenotsatisfiable_test.go | ||
requestentitytoolarge.go | ||
requestentitytoolarge_test.go | ||
requestheaderfieldstoolarge.go | ||
requestheaderfieldstoolarge_test.go | ||
requesttimeout.go | ||
requesttimeout_test.go | ||
requesturitoolong.go | ||
requesturitoolong_test.go | ||
servererror.go | ||
servererror_test.go | ||
serviceunavailable.go | ||
teapot.go | ||
teapot_test.go | ||
toomanyrequests.go | ||
toomanyrequests_test.go | ||
unauthorized.go | ||
unauthorized_test.go | ||
unavailableforlegalreasons.go | ||
unavailableforlegalreasons_test.go | ||
unprocessableentity.go | ||
unprocessableentity_test.go | ||
unsupportedmediatype.go | ||
unsupportedmediatype_test.go | ||
upgraderequired.go | ||
upgraderequired_test.go | ||
variantaisonegotiates.go |
README.md
go-errhttp
Package errhttp provides types errors that make dealing with HTTP response errors easier, for the Go programming language.
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 errhtp.InternalServerError:
//@TODO
case errhtp.ClientError:
//@TODO
case errhtp.ServerError:
//@TODO
default:
//@TODO
}
Documention
Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-errhttp