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 bbaaf21002 added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -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 package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
badrequest.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -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 package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -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 .Unwrap()error methods, and some error checking 2023-02-15 22:24:28 -08:00
expectationfailed.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
expectationfailed_test.go client errors 2017-02-06 12:58:13 -08:00
faileddependency.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
faileddependency_test.go client errors 2017-02-06 12:58:13 -08:00
forbidden.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
forbidden_test.go client errors 2017-02-06 12:58:13 -08:00
gatewaytimeout.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
gone.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
gone_test.go client errors 2017-02-06 12:58:13 -08:00
httpversionnotsupported.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
insufficientstorage.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
internalservererror.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
lengthrequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
lengthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
locked.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
locked_test.go client errors 2017-02-06 12:58:13 -08:00
loopdetected.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
methodnotallowed.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
methodnotallowed_test.go client errors 2017-02-06 12:58:13 -08:00
networkauthenticationrequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
notacceptable.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
notacceptable_test.go client errors 2017-02-06 12:58:13 -08:00
notextended.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
notfound.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
notfound_test.go client errors 2017-02-06 12:58:13 -08:00
notimplemented.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
payloadtoolarge.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
payloadtoolarge_test.go errhttp.PayloadTooLarge 2019-07-19 16:33:55 -07:00
paymentrequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
paymentrequired_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionfailed.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
preconditionfailed_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionrequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
preconditionrequired_test.go client errors 2017-02-06 12:58:13 -08:00
proxyauthrequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
proxyauthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
requestedrangenotsatisfiable.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
requestedrangenotsatisfiable_test.go client errors 2017-02-06 12:58:13 -08:00
requestentitytoolarge.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
requestentitytoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requestheaderfieldstoolarge.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
requestheaderfieldstoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requesttimeout.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
requesttimeout_test.go client errors 2017-02-06 12:58:13 -08:00
requesturitoolong.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -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 package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
teapot.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
teapot_test.go client errors 2017-02-06 12:58:13 -08:00
toomanyrequests.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
toomanyrequests_test.go client errors 2017-02-06 12:58:13 -08:00
unauthorized.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
unauthorized_test.go client errors 2017-02-06 12:58:13 -08:00
unavailableforlegalreasons.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
unavailableforlegalreasons_test.go client errors 2017-02-06 12:58:13 -08:00
unprocessableentity.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
unprocessableentity_test.go client errors 2017-02-06 12:58:13 -08:00
unsupportedmediatype.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
unsupportedmediatype_test.go client errors 2017-02-06 12:58:13 -08:00
upgraderequired.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
upgraderequired_test.go client errors 2017-02-06 12:58:13 -08:00
uritoolong.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -08:00
uritoolong_test.go errhttp.URITooLong 2019-07-19 16:50:18 -07:00
variantaisonegotiates.go added package-level globals for each error. in case the developer does not want to set their own error message or wrap another error. 2023-02-16 11:36:53 -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