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
{{ message }}
Repository navigation
Wrapped multi-errors should implement Unwrap() []error #38
errtrace errors only implement Unwrap() error right now.
This hides the actual list of errors for wrapped multi-errors.
We need to implement Unwrap() []error if the error we're wrapping is a multi-error.
Alternatively, we can always implement only Unwrap() []error, and things should still just work.
This hides the actual list of errors for wrapped multi-errors.
Actually, this isn't quite right. Even with just Unwrap() error, we're exposing the underlying list on the "next" layer, so it's not entirely inaccessible. But it's still going to be annoying. Although I'm not entirely certain that implementing Unwrap() []error is the right choice there, because transparently skipping the actual wrapped error means fmt.Errorf("information: %w %w", a, b) will unpack to a and b, ignoring information entirely.
Separately, maybe we also need an errtrace.Unwrap that's a drop-in replacement for errors.Unwrap, and all it does is transparently unwrap the top-level errtrace error—if any. That can be a separate discussion.
changed the title [-]Wrapped multi-errors should implement Unwrap() []error[/-][+]Add errtrace.Unwrap() function as drop-in for errors.Unwrap[/+]on Nov 29, 2023
changed the title [-]Add errtrace.Unwrap() function as drop-in for errors.Unwrap[/-][+]Wrapped multi-errors should implement Unwrap() []error[/+]on Nov 29, 2023
Activity
abhinav commentedon Nov 28, 2023
Actually, this isn't quite right. Even with just
Unwrap() error, we're exposing the underlying list on the "next" layer, so it's not entirely inaccessible. But it's still going to be annoying. Although I'm not entirely certain that implementingUnwrap() []erroris the right choice there, because transparently skipping the actual wrapped error meansfmt.Errorf("information: %w %w", a, b)will unpack to a and b, ignoring information entirely.Separately, maybe we also need an
errtrace.Unwrapthat's a drop-in replacement forerrors.Unwrap, and all it does is transparently unwrap the top-level errtrace error—if any. That can be a separate discussion.[-]Wrapped multi-errors should implement Unwrap() []error[/-][+]Add errtrace.Unwrap() function as drop-in for errors.Unwrap[/+][-]Add errtrace.Unwrap() function as drop-in for errors.Unwrap[/-][+]Wrapped multi-errors should implement Unwrap() []error[/+]