proxy.golang.org : github.com/srfrog/fail
Package fail is used to manage Go errors as HTTP responses. The goal is to respond to web clients nicely, and inspect errors. To use fail, you must wrap Go errors using “fail.Cause“. This function will return a “Fail“ object that implements the “error“ interface. Also, the location of the original error is saved in the object for later inspection. The “Fail“ object can be further handled with methods matching HTTP responses such as “fail.BadRequest“ and “fail.NotFound“. Finally, to respond to a web client we use the “fail.Say“ function which returns the HTTP status code and message that can be sent via “http.Error“.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/srfrog/fail
License: MIT
Latest release: about 22 hours ago
Namespace: github.com/srfrog
Stars: 9 on GitHub
Forks: 1 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 22 hours ago