Replace %v with %w to wrap underlying errors
Main motivation was fix to ListChain error to be able to handle errors.Is(err, unix.ENOENT), but then I found more errors which doesn't pass underlying error information and decided to fix them all.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Thanks for your PR!
Main motivation was fix to
ListChainerror to be able to handleerrors.Is(err, unix.ENOENT), but then I found more errors which doesn't pass underlying error information and decided to fix them all.
Changing all functions to pass through underlying errors is not “fixing them all”: Whether or not it makes sense to pass through an underlying error needs to be carefully examined on a case-by-case basis. See https://groups.google.com/g/golang-nuts/c/-bYObQTWX_8/m/9iwZrQnIBAAJ and https://matttproud.com/blog/posts/go-errors-and-api-contracts.html for rationale/discussion.
If you want to move forward with your PR, please reduce scope to only the errors you specifically care about and have tested, and then I can take another look. Thanks.
@corpix IMO it's only
fmt.Errorf("conn.Execute failed: %v", err)
and
fmt.Errorf("receive: %v", err) // used to be "receiveAckAware"
that should wrap the underlying error, since they may carry an errno that can be handled. The rest might not be needed. Were you planning to trim your PR to just those? I’d appreciate this change as I’d like to handle ENOENT as you described.
If there is not only me want this changes then I have no other choice. Will try to clean up PR today :)