File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package errors
2+
3+ import "errors"
4+
5+ // New returns an error that formats as the given text.
6+ // Wraps original errors.New function to avoid importing "errors".
7+ func New (text string ) error {
8+ return errors .New (text )
9+ }
10+
11+ // Is reports whether any error in err's chain matches target.
12+ // Wraps original errors.Is function to avoid importing "errors".
13+ func Is (err , target error ) bool {
14+ return errors .Is (err , target )
15+ }
16+
17+ // As finds the first error in err's chain that matches target, and if one is found,
18+ // sets target to that error value and returns true. Otherwise, it returns false.
19+ // Wraps original errors.As function to avoid importing "errors".
20+ func As (err error , target interface {}) bool {
21+ return errors .As (err , target )
22+ }
23+
24+ // Unwrap returns the result of calling the Unwrap method on err, if err's type contains
25+ // an Unwrap method returning error. Otherwise, Unwrap returns nil.
26+ // Wraps original errors.Unwrap function to avoid importing "errors".
27+ func Unwrap (err error ) error {
28+ return errors .Unwrap (err )
29+ }
You can’t perform that action at this time.
0 commit comments