-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently, .IsError(...) only accepts either nil to check there is no error, or another error that must match directly or indirectly through error wrapping.
Suggested extended behavior:
.IsError(nil) // no error -- currently supported
.IsError() // any error
.IsError(sentinel) // match specific error -- currently supported
.IsError(str) // error message contains string
.IsError(regex) // error message matches regexpRedefining it a IsError(match ...any) preserves backward compatibility (currently accepting 1 error argument), supports the new 0 argument case, and supports non-error expectations. Specifying more than 1 argument or unsupported argument types can be handled as an error. Similar pattern is used in other frameworks (e.g. fiber) to simulate optional argument.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request