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"
66
77// IsOfType is a type check for errors.
88// 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 .
1010func IsOfType (err error , t * Type ) bool {
1111 e := burrowForTyped (err )
1212 return e != nil && e .IsOfType (t )
@@ -16,6 +16,7 @@ func IsOfType(err error, t *Type) bool {
1616// IsOfType is a proper type check for an errorx-based errors.
1717// It takes the transparency and error types hierarchy into account,
1818// 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.
1920func (e * Error ) IsOfType (t * Type ) bool {
2021 cause := e
2122 for cause != nil {
You can’t perform that action at this time.
0 commit comments