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