File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,7 @@ func (e *Error) HasTrait(key Trait) bool {
8989 cause := e
9090 for cause != nil {
9191 if ! cause .transparent {
92- _ , ok := cause .errorType .traits [key ]
93- return ok
92+ return cause .errorType .HasTrait (key )
9493 }
9594
9695 cause = Cast (cause .Cause ())
Original file line number Diff line number Diff line change @@ -88,6 +88,12 @@ func (t *Type) IsOfType(other *Type) bool {
8888 return false
8989}
9090
91+ // HasTrait checks if a type possesses the expected trait.
92+ func (t * Type ) HasTrait (key Trait ) bool {
93+ _ , ok := t .traits [key ]
94+ return ok
95+ }
96+
9197// IsOfType is a type check for errors.
9298// Returns true either if both are of exactly the same type, or if the same is true for one of current type's ancestors.
9399// For an error that does not have an errorx type, returns false.
You can’t perform that action at this time.
0 commit comments