Skip to content
Myr

Improves errors.ByType() implementation

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Manu Mtz-Almeida · committed by Manu Mtz-Almeida · parent c0383df · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:errors.go+4 added-1 removed
84 unmodified lines
85func (a errorMsgs) ByType(typ ErrorType) errorMsgs {86 if len(a) == 0 {87 return nil88 }89 if typ == ErrorTypeAny {90 return a91 }92 var result errorMsgs = nil93 for _, msg := range a {91 if msg.Type&typ > 0 {94 if msg.IsType(typ) {95 result = append(result, msg)96 }97 }98 return result
63 unmodified lines