An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

github.com/joomcode/Errorx

Package errorx provides error implementation and error-related utilities. Conventional approach towards errors in Go is quite limited. The typical case implies an error being created at some point: Then being passed along with a no-brainer: And, finally, handled by printing it to the log file: This approach is simple, but quite often it is not enough. There is a need to add context information to error, to check or hide its properties. If all else fails, it pays to have a stack trace printed along with error text. The code above could be modified in this fashion: Here errorx.Decorate is used to add more information, and syntax like errorx.IsOfType can still be used to check the original error. This error also holds a stack trace captured at the point of creation. With errorx syntax, any of this may be customized: stack trace can be omitted, error type can be hidden. Type can be further customized with Traits, and error with Properties. Package provides utility functions to compose, switch over, check, and ignore errors based on their types and properties. See documentation for Error, Type and Namespace for more details.

Ecosystem
proxy.golang.org
Latest Release
v1.2.0
over 1 year ago
Versions
9
Links
Registry proxy.golang.org
Source Repository
Docs Documentation
JSON API View JSON
CodeMeta codemeta.json
Package Details
PURL pkg:golang/github.com/joomcode/%21errorx
spec
License MIT
Namespace github.com/joomcode
First Release over 7 years ago
Last Synced 18 days ago
Repository
Stars 958 on GitHub
Forks 28 on GitHub
Rankings on proxy.golang.org
Overall Top 5.1%
Forks Top 2.7%