File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import "errors"
6
6
7
7
// IsOfType is a type check for errors.
8
8
// Returns true either if both are of exactly the same type, or if the same is true for one of current type's ancestors.
9
- // For an error that does not have an errorx type, returns false.
9
+ // For an error that does not have an errorx type, returns false unless it wraps another error of errorx type .
10
10
func IsOfType (err error , t * Type ) bool {
11
11
e := burrowForTyped (err )
12
12
return e != nil && e .IsOfType (t )
@@ -16,6 +16,7 @@ func IsOfType(err error, t *Type) bool {
16
16
// IsOfType is a proper type check for an errorx-based errors.
17
17
// It takes the transparency and error types hierarchy into account,
18
18
// so that type check against any supertype of the original cause passes.
19
+ // It also tolerates non-errorx errors in chain if those errors support go 1.13 errors unwrap.
19
20
func (e * Error ) IsOfType (t * Type ) bool {
20
21
cause := e
21
22
for cause != nil {
You can’t perform that action at this time.
0 commit comments