You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently the error handler converts the registered errors to a string and the matcher just matches the string representation of the provided error. If the error is wrapped inside another error this check fails.
My suggestion is registering the error handlers either as an error reference or an interface {Error() string} type, and use the methods errors.Is and errors.As to match them.
The text was updated successfully, but these errors were encountered:
Hey @bkmeneguello, thanks for the suggestion! This sounds like a great improvement. I do think it'd require a change in the interface of the ErrorRegistry, to be able to register an instantiated object in the registry map. So a v3 would likely be necessary. Something like RegisterErrorHandler[E error](error, func (context.Context, error) (int, any) perhaps.
I'll play around with it and see what a v3 could look like :)
Currently the error handler converts the registered errors to a string and the matcher just matches the string representation of the provided error. If the error is wrapped inside another error this check fails.
My suggestion is registering the error handlers either as an
error
reference or aninterface {Error() string}
type, and use the methodserrors.Is
anderrors.As
to match them.The text was updated successfully, but these errors were encountered: