gotosocial/vendor/github.com/go-errors/errors/error_1_13.go
Tobi Smethurst 98263a7de6
Grand test fixup (#138)
* start fixing up tests

* fix up tests + automate with drone

* fiddle with linting

* messing about with drone.yml

* some more fiddling

* hmmm

* add cache

* add vendor directory

* verbose

* ci updates

* update some little things

* update sig
2021-08-12 21:03:24 +02:00

32 lines
635 B
Go

// +build go1.13
package errors
import (
baseErrors "errors"
)
// find error in any wrapped error
func As(err error, target interface{}) bool {
return baseErrors.As(err, target)
}
// 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
}