mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-07-04 21:05:47 +00:00
98263a7de6
* 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
32 lines
635 B
Go
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
|
|
}
|