Top 0.1% dependent packages on proxy.golang.org
Top 0.1% dependent repos on proxy.golang.org
Top 2.8% forks on proxy.golang.org
Top 0.2% docker downloads on proxy.golang.org
proxy.golang.org : github.com/juju/errors
Package errors provides an easy way to annotate errors without losing the original error context. The exported `New` and `Errorf` functions are designed to replace the `errors.New` and `fmt.Errorf` functions respectively. The same underlying error is there, but the package also records the location at which the error was created. A primary use case for this library is to add extra context any time an error is returned from a function. This instead becomes: which just records the file and line number of the Trace call, or which also adds an annotation to the error. When you want to check to see if an error is of a particular type, a helper function is normally exported by the package that returned the error, like the `os` package does. The underlying cause of the error is available using the `Cause` function. The result of the `Error()` call on an annotated error is the annotations joined with colons, then the result of the `Error()` method for the underlying error that was the cause. Obviously recording the file, line and functions is not very useful if you cannot get them back out again. will return something like: The first error was generated by an external system, so there was no location associated. The second, fourth, and last lines were generated with Trace calls, and the other two through Annotate. Sometimes when responding to an error you want to return a more specific error for the situation. This returns an error where the complete error stack is still available, and `errors.Cause()` will return the `NotFound` error.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/juju/errors
License: LGPL-3.0
Latest release: almost 3 years ago
First release: almost 3 years ago
Namespace: github.com/juju
Dependent packages: 1,596
Dependent repositories: 4,140
Stars: 1,352 on GitHub
Forks: 88 on GitHub
Docker dependents: 307
Docker downloads: 412,778,227
See more repository details: repos.ecosyste.ms
Last synced: 5 months ago