-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnative.go
More file actions
29 lines (24 loc) · 1011 Bytes
/
native.go
File metadata and controls
29 lines (24 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package errors
import "errors"
// New returns an error that formats as the given text.
// Wraps original errors.New function to avoid importing "errors".
func New(text string) error {
return errors.New(text)
}
// Is reports whether any error in err's chain matches target.
// Wraps original errors.Is function to avoid importing "errors".
func Is(err, target error) bool {
return errors.Is(err, target)
}
// As finds the first error in err's chain that matches target, and if one is found,
// sets target to that error value and returns true. Otherwise, it returns false.
// Wraps original errors.As function to avoid importing "errors".
func As(err error, target interface{}) bool {
return errors.As(err, target)
}
// Unwrap returns the result of calling the Unwrap method on err, if err's type contains
// an Unwrap method returning error. Otherwise, Unwrap returns nil.
// Wraps original errors.Unwrap function to avoid importing "errors".
func Unwrap(err error) error {
return errors.Unwrap(err)
}