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 @@ -94,8 +94,7 @@ func (e *Error) HasTrait(key Trait) bool {
9494 cause := e
9595 for cause != nil {
9696 if ! cause .transparent {
97- _ , ok := cause .errorType .traits [key ]
98- return ok
97+ return cause .errorType .HasTrait (key )
9998 }
10099
101100 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