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 1b349fbb21 server error 2017-02-06 13:14:15 -08:00
LICENSE initial commit 2017-02-06 12:57:57 -08:00
README.md updated docs 2017-02-06 13:04:29 -08:00
badgateway.go server error 2017-02-06 13:14:15 -08:00
badrequest.go client errors 2017-02-06 12:58:13 -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 client errors 2017-02-06 12:58:13 -08:00
conflict_test.go client errors 2017-02-06 12:58:13 -08:00
doc.go updated docs 2017-02-06 13:04:29 -08:00
error.go client errors 2017-02-06 12:58:13 -08:00
expectationfailed.go client errors 2017-02-06 12:58:13 -08:00
expectationfailed_test.go client errors 2017-02-06 12:58:13 -08:00
faileddependency.go client errors 2017-02-06 12:58:13 -08:00
faileddependency_test.go client errors 2017-02-06 12:58:13 -08:00
forbidden.go client errors 2017-02-06 12:58:13 -08:00
forbidden_test.go client errors 2017-02-06 12:58:13 -08:00
gatewaytimeout.go server error 2017-02-06 13:14:15 -08:00
gone.go client errors 2017-02-06 12:58:13 -08:00
gone_test.go client errors 2017-02-06 12:58:13 -08:00
httpversionnotsupported.go server error 2017-02-06 13:14:15 -08:00
insufficientstorage.go server error 2017-02-06 13:14:15 -08:00
internalservererror.go server error 2017-02-06 13:14:15 -08:00
lengthrequired.go client errors 2017-02-06 12:58:13 -08:00
lengthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
locked.go client errors 2017-02-06 12:58:13 -08:00
locked_test.go client errors 2017-02-06 12:58:13 -08:00
loopdetected.go server error 2017-02-06 13:14:15 -08:00
methodnotallowed.go client errors 2017-02-06 12:58:13 -08:00
methodnotallowed_test.go client errors 2017-02-06 12:58:13 -08:00
networkauthenticationrequired.go server error 2017-02-06 13:14:15 -08:00
notacceptable.go client errors 2017-02-06 12:58:13 -08:00
notacceptable_test.go client errors 2017-02-06 12:58:13 -08:00
notextended.go server error 2017-02-06 13:14:15 -08:00
notfound.go client errors 2017-02-06 12:58:13 -08:00
notfound_test.go client errors 2017-02-06 12:58:13 -08:00
notimplemented.go server error 2017-02-06 13:14:15 -08:00
paymentrequired.go client errors 2017-02-06 12:58:13 -08:00
paymentrequired_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionfailed.go client errors 2017-02-06 12:58:13 -08:00
preconditionfailed_test.go client errors 2017-02-06 12:58:13 -08:00
preconditionrequired.go client errors 2017-02-06 12:58:13 -08:00
preconditionrequired_test.go client errors 2017-02-06 12:58:13 -08:00
proxyauthrequired.go client errors 2017-02-06 12:58:13 -08:00
proxyauthrequired_test.go client errors 2017-02-06 12:58:13 -08:00
requestedrangenotsatisfiable.go client errors 2017-02-06 12:58:13 -08:00
requestedrangenotsatisfiable_test.go client errors 2017-02-06 12:58:13 -08:00
requestentitytoolarge.go client errors 2017-02-06 12:58:13 -08:00
requestentitytoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requestheaderfieldstoolarge.go client errors 2017-02-06 12:58:13 -08:00
requestheaderfieldstoolarge_test.go client errors 2017-02-06 12:58:13 -08:00
requesttimeout.go client errors 2017-02-06 12:58:13 -08:00
requesttimeout_test.go client errors 2017-02-06 12:58:13 -08:00
requesturitoolong.go client errors 2017-02-06 12:58:13 -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 server error 2017-02-06 13:14:15 -08:00
teapot.go client errors 2017-02-06 12:58:13 -08:00
teapot_test.go client errors 2017-02-06 12:58:13 -08:00
toomanyrequests.go client errors 2017-02-06 12:58:13 -08:00
toomanyrequests_test.go client errors 2017-02-06 12:58:13 -08:00
unauthorized.go client errors 2017-02-06 12:58:13 -08:00
unauthorized_test.go client errors 2017-02-06 12:58:13 -08:00
unavailableforlegalreasons.go client errors 2017-02-06 12:58:13 -08:00
unavailableforlegalreasons_test.go client errors 2017-02-06 12:58:13 -08:00
unprocessableentity.go client errors 2017-02-06 12:58:13 -08:00
unprocessableentity_test.go client errors 2017-02-06 12:58:13 -08:00
unsupportedmediatype.go client errors 2017-02-06 12:58:13 -08:00
unsupportedmediatype_test.go client errors 2017-02-06 12:58:13 -08:00
upgraderequired.go client errors 2017-02-06 12:58:13 -08:00
upgraderequired_test.go client errors 2017-02-06 12:58:13 -08:00
variantaisonegotiates.go server error 2017-02-06 13:14:15 -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 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

GoDoc