-
Notifications
You must be signed in to change notification settings - Fork 346
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
Error wrapping in t3c #6157
base: master
Are you sure you want to change the base?
Error wrapping in t3c #6157
Conversation
97f8124
to
5945bbb
Compare
b62a18b
to
a3d9335
Compare
See my comment on #6159 (comment) about performance.
Again, I support the idea of this. And I can't say how much an impact this has without testing. But it'd be really good if, before merging something potentially performance-impacting like this, if someone benchmarked |
a3d9335
to
707b099
Compare
707b099
to
5092d88
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #6157 +/- ##
============================================
+ Coverage 31.91% 31.92% +0.01%
Complexity 98 98
============================================
Files 719 719
Lines 82788 82774 -14
Branches 970 970
============================================
+ Hits 26423 26428 +5
+ Misses 54202 54184 -18
+ Partials 2163 2162 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This makes errors constructed in from other errors in t3c (everything under
cache-config/
) use error-wrapping formatting so that the identity of the underlying error is not destroyed. It also ensures that:errors.Is
errors.As
Originally, I was going to do that for everything in the repo at once, but I drastically underestimated how large that changeset would be. So I just started with the first component alphabetically. Partially because I did originally want this to encompass the whole repo, there's also a change in here that that removes a newline from an error string in
traffic_vault_migrate
and some changes to the db/admin program - I left those in because I figured it was harmless to do so, but I can take them out at a reviewer's request.Which Traffic Control components are affected by this PR?
What is the best way to verify this PR?
Make sure all the tests still pass. To check for non-wrapping errors, I grepped with the regular expression:
which does output some false positives where an error is passed to
fmt.Errorf
that just so happens to use%v
to format something that isn't an error. I also usederrorlint
, which is available through golangci-lint, to catch cases where errors.Is and errors.As should be used (but that won't catch all the things the regexp does, it'll miss things likeerrors.New(err.Error())
). Finally, I checked for matches tobut that yielded no results, so no changes were necessary.
PR submission checklist