Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type All ¶
type All []ErrorMatcher
All matches an error if all of the underlying matchers match it.
func (All) MatchError ¶
MatchError calls underlying matchers with err. If all of them matches err it returns true, otherwise false.
type Any ¶
type Any []ErrorMatcher
Any matches an error if any of the underlying matchers match it.
func (Any) MatchError ¶
MatchError calls underlying matchers with err. If any of them matches err it returns true, otherwise false.
type ErrorMatcher ¶
type ErrorMatcher interface { // MatchError checks if err matches a certain condition. MatchError(err error) bool }
ErrorMatcher checks if an error matches a certain condition.
func As ¶
func As(target interface{}) ErrorMatcher
As returns an error matcher that determines matching by calling errors.As.
func Is ¶
func Is(target error) ErrorMatcher
Is returns an error matcher that determines matching by calling errors.Is.
type ErrorMatcherFunc ¶ added in v0.5.2
ErrorMatcherFunc turns a plain function into an ErrorMatcher if it's definition matches the interface.
func (ErrorMatcherFunc) MatchError ¶ added in v0.5.2
func (fn ErrorMatcherFunc) MatchError(err error) bool
MatchError calls the underlying function to check if err matches a certain condition.