-
Notifications
You must be signed in to change notification settings - Fork 353
docs(errors): add MADR modern error handling strategy #15112
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
base: master
Are you sure you want to change the base?
Conversation
d34379e to
8c94c51
Compare
Reviewer Checklist🔍 Each of these sections need to be checked by the reviewer of the PR 🔍:
|
8c94c51 to
eca37b9
Compare
eca37b9 to
19e841d
Compare
Addresses inconsistency between MADR 073 (stdlib) and codebase (pkg/errors). Recommends migrating to cockroachdb/errors for stack traces + performance. Co-authored-by: Bart Smykla <[email protected]> Signed-off-by: Marcin Skalski <[email protected]>
42ada10 to
eb2d91c
Compare
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| ### Option 3: Migrate to `github.com/cockroachdb/errors` | ||
|
|
||
| Drop-in replacement, actively maintained. | ||
|
|
||
| ```go | ||
| import "github.com/cockroachdb/errors" | ||
| return errors.Wrapf(err, "sync failed: zone=%s", zone) | ||
| ``` | ||
|
|
||
| **Pros:** Stack traces, better perf, drop-in replacement, maintained, stdlib compatible | ||
| **Cons:** External dep, migration effort |
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.
I’m not fully convinced we should use a new library for this. It seems to include many features we don’t need, which would introduce indirect dependencies and potentially increase our security surface. I do like the stack traces—since fmt doesn’t provide them—but given the migration effort and the lack of clear performance benefits, I’m not sure it’s worth adopting.
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.
there is not much stuff to migrate actually, it would be similar if we would like to move to fmt in the future
Motivation
Kuma has inconsistent error handling:
fmt.Errorf+%wgithub.com/pkg/errors(30+ usages)Requirements: stack traces, best performance, no timeline.
Implementation information
Created MADR 094 analyzing 4 options:
Decision: Gradual migration to cockroachdb/errors.
Supporting documentation