-
Notifications
You must be signed in to change notification settings - Fork 436
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
Print out errname in impl Debug for Error
#287
Conversation
This comment has been minimized.
This comment has been minimized.
@@ -61,6 +63,26 @@ impl Error { | |||
} | |||
} | |||
|
|||
impl fmt::Debug for Error { | |||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
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 like the idea that we could have names instead of values for the Debug::fmt
of Error
. However, I think it's better that we don't need to call errname
if we already have the corresponding const, e.g. Error::EINVAL
, because having the const actually means we have names for the error numbers at Rust side.
Thoughts?
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.
We don't currently have constants for all errors defined in Rust. Plus, defining them in Rust essentially requires us to have a giant match, or define a lookup table like errname.c
did. It might be better just to reuse errname
, C side needs it anyway.
I think there are a few further improvements that can be made to
|
This comment has been minimized.
This comment has been minimized.
I like this. Moving to a more constrained type would eliminate at least one human "proof" elsewhere. That's probably a Good Thing(tm). |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Gary Guo <[email protected]>
Review of
|
LGTM. |
We could put some of #287 (comment) as an issue, perhaps a "good first issue". |
Depends on #273Merged