-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Propagate/wrap invalid account errors #3313
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we avoid using errors.Wrap, and use fmt.Errorf("... %w ...") iunstead?
@jeremyletang I think we should switch to wrapping errors in structs instead of in strings. See https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully for details. |
I think we should use the |
$ find -name vendor -prune -o -name '*.go' -print | xargs grep errors.Wrap |wc -l
60
$ find -name vendor -prune -o -name '*.go' -print | xargs grep -E 'fmt.Errorf.*?%w' |wc -l
31
$ find -name vendor -prune -o -name '*.go' -print | xargs grep fmt.Errorf |wc -l
462
$ find -name vendor -prune -o -name '*.go' -print | xargs grep 'return.*Err[A-Z]' |wc -l
510
There is already a mixture of error reporting going on in the app atm. Perhaps the debate on the One Correct Way can be postponed for now. |
Well ultimately they are all valid ones, just the 2 first ones serves the same purpose. And we'll go with the second one which provides same features from the standard library. So let's just not add more work for the future us at replacing errros.Wrap maybe? |
We currently have a mix of error reporting stuff because |
Hey @jeremyletang @ashleyvega @EVODelavega, looks like an interesting debate here and one that would be a good candidate to discuss and agree a standard approach as a team. For right now, we need to get this work merged (!) and as it seems there is already a mix of approaches I would suggest going for the one that is already done rather than changing it now, to get it through and then I propose we use the retrospective time tomorrow afternoon to see if there is a standard approach we could all get onboard with going forward. Sound OK? |
This PR slightly improves error handling by propagating the ID of invalid account.
It also uses
errors.Wrap(err, "info")
to show where some errors came from.