-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Establish a new error handling project group #2965
Changes from 1 commit
bfe00b6
5bfa046
d12f66a
c9804b1
508f438
23e262d
e3e1a36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -43,6 +43,13 @@ Here is a tenative starting point, subject to change: | |||||
- What is the consensus on handling `dyn Error`s? Should it be encouraged or discouraged? Should we look into making `Box<dyn Error...>` implement `Error`? | ||||||
|
||||||
|
||||||
### Identify pain points in error handling today | ||||||
|
||||||
- Backtrace capture is expensive, but without one it can be difficult to pinpoint the origin of errors | ||||||
- unwrap on errors without first converting to a reporting type will often discard relevant information | ||||||
yaahc marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
- errors printing from main have to assume a prefixed `Error: `, sub par control of output format when printing during termination. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what "have to assume a prefixed There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm referring to this default in |
||||||
- Error trait only exposes 3 forms of context, can only represent singly linked lists for chains of errors | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unclear what the pain points are here.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3 is not enough, I'd like to be able to return Singly linked lists can be painful for parsers for example, where you encounter multiple errors at once, and they're all the source for a single higher level error, so your chain of errors looks a little more like a tree. This is also addressed by the generic member access proposal where you could access a |
||||||
|
||||||
### Communicate current best practices | ||||||
|
||||||
- Document the consensus. | ||||||
|
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 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 generally disagree with the universal applicability of this point as well; this is a key point of SNAFU — producing a semantic backtrace via the error types.
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.
Assuming I understand what you mean, I think that the semantic backtraces via
SNAFU
can definitely help here but I don't think they're a universal solution. It still fairly easy to misuse. For example, if a developer introduces a higher level snafu error to handle anio::Error
, but then uses this type liberally throughout the code. Unless you carefully create one variant per source location the origin of errors can still be lost.Here's an example of this kind of thing going wrong via
thiserror
. ZcashFoundation/zebra#758