Package errhttp provides errors and types that make dealing with HTTP response errors easier, for the Go programming language.
Go to file
Charles Iliya Krempeaux 593a440c11 added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
LICENSE initial commit 2017-02-06 12:57:57 -08:00
README.md correction to docs. corrected typo. 2019-07-15 12:31:32 -07:00
badgateway.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
badrequest.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
badrequest_test.go client errors 2017-02-06 12:58:13 -08:00
clienterror.go client errors 2017-02-06 12:58:13 -08:00
clienterror_test.go client errors 2017-02-06 12:58:13 -08:00
conflict.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
conflict_test.go client errors 2017-02-06 12:58:13 -08:00
doc.go correction to docs. corrected typo. 2019-07-15 12:31:32 -07:00
error.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
expectationfailed.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
expectationfailed_test.go client errors 2017-02-06 12:58:13 -08:00
faileddependency.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
faileddependency_test.go client errors 2017-02-06 12:58:13 -08:00
forbidden.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
forbidden_test.go client errors 2017-02-06 12:58:13 -08:00
gatewaytimeout.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
gone.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
gone_test.go client errors 2017-02-06 12:58:13 -08:00
httpversionnotsupported.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
insufficientstorage.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
internalservererror.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
lengthrequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
lengthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
locked.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
locked_test.go client errors 2017-02-06 12:58:13 -08:00
loopdetected.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
methodnotallowed.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
methodnotallowed_test.go client errors 2017-02-06 12:58:13 -08:00
networkauthenticationrequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
notacceptable.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
notacceptable_test.go client errors 2017-02-06 12:58:13 -08:00
notextended.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
notfound.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
notfound_test.go client errors 2017-02-06 12:58:13 -08:00
notimplemented.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
payloadtoolarge.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
payloadtoolarge_test.go errhttp.PayloadTooLarge 2019-07-19 16:33:55 -07:00
paymentrequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
paymentrequired_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionfailed.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
preconditionfailed_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionrequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
preconditionrequired_test.go client errors 2017-02-06 12:58:13 -08:00
proxyauthrequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
proxyauthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
requestedrangenotsatisfiable.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
requestedrangenotsatisfiable_test.go client errors 2017-02-06 12:58:13 -08:00
requestentitytoolarge.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
requestentitytoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requestheaderfieldstoolarge.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
requestheaderfieldstoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requesttimeout.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
requesttimeout_test.go client errors 2017-02-06 12:58:13 -08:00
requesturitoolong.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
requesturitoolong_test.go client errors 2017-02-06 12:58:13 -08:00
servererror.go client errors 2017-02-06 12:58:13 -08:00
servererror_test.go server error 2017-02-06 13:14:15 -08:00
serviceunavailable.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
teapot.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
teapot_test.go client errors 2017-02-06 12:58:13 -08:00
toomanyrequests.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
toomanyrequests_test.go client errors 2017-02-06 12:58:13 -08:00
unauthorized.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
unauthorized_test.go client errors 2017-02-06 12:58:13 -08:00
unavailableforlegalreasons.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
unavailableforlegalreasons_test.go client errors 2017-02-06 12:58:13 -08:00
unprocessableentity.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
unprocessableentity_test.go client errors 2017-02-06 12:58:13 -08:00
unsupportedmediatype.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
unsupportedmediatype_test.go client errors 2017-02-06 12:58:13 -08:00
upgraderequired.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
upgraderequired_test.go client errors 2017-02-06 12:58:13 -08:00
uritoolong.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00
uritoolong_test.go errhttp.URITooLong 2019-07-19 16:50:18 -07:00
variantaisonegotiates.go added .ErrHTTP() method so can detect these are these type of errors 2023-02-16 12:01:00 -08:00

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 errhttp.InternalServerError:
		//@TODO
	
	case errhttp.ClientError:
		//@TODO
	case errhttp.ServerError:
		//@TODO
	
	default:
		//@TODO
	}

Documention

Online documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-errhttp

GoDoc