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
-1 this bug fix introduces more bugs than it actually resolves, and does not actually perform the action that the title of this PR even declares it to do.
Given:
err := errors.WithStack(&net.OpError{
Err: io.EOF,
})
err.Unwrap() == io.EOF // this is true
To obtain what the PR title says it should, the interface type assertion should be a type assertion to to the concrete *withMessage type. But this still still introduce more bugs.
I would expect the err.Unwrap() from the error returned by g() to return the error returned by f(), but it would not, it would return io.EOF. While this trivial example seems silly, the wrapping with the message and the stack could potentially happen significantly far apart from each other in code, and one would be left confused about why the WithMessage was also unwrapped.
The expected behavior that this PR is trying to solve is errors.Wrap(err) == err should be true. But errors.WithStack(err) == err and errors.WithMessage(err) == err should also universally be true.
In order to get the critical desired behavior errors.Wrap(err) == err, we would want to create a new withStackAndMessage error that does both behaviors, and properly unwraps as expected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.