diff options
Diffstat (limited to 'vendor/github.com/go-errors/errors/error_1_13.go')
-rw-r--r-- | vendor/github.com/go-errors/errors/error_1_13.go | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vendor/github.com/go-errors/errors/error_1_13.go b/vendor/github.com/go-errors/errors/error_1_13.go new file mode 100644 index 000000000..a81e24eae --- /dev/null +++ b/vendor/github.com/go-errors/errors/error_1_13.go @@ -0,0 +1,26 @@ +// +build go1.13 + +package errors + +import ( + baseErrors "errors" +) + +// Is detects whether the error is equal to a given error. Errors +// are considered equal by this function if they are matched by errors.Is +// or if their contained errors are matched through errors.Is +func Is(e error, original error) bool { + if baseErrors.Is(e, original) { + return true + } + + if e, ok := e.(*Error); ok { + return Is(e.Err, original) + } + + if original, ok := original.(*Error); ok { + return Is(e, original.Err) + } + + return false +} |