-
Notifications
You must be signed in to change notification settings - Fork 258
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
Custom Debug
impl for DispatchError
#1153
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.
Looks great, thank you!
), | ||
}; | ||
|
||
write!(f, "ModuleError(<{details}>)") |
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.
nit: Would it be beneficial to have this syntax ModuleError<..>
also for the Display
impl?
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.
Fine by me, wdyt @jsdw?
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 think the display impl can be "prettier" (it doesn't need to fit in with the rust like syntax that everything else spits out for debug impls), but perhaps we should indeed standardise these; maybe Debug should print ModuleError(<{details}>)
as it does here and Display should just print {details}
, so we can have a shared func to write details and then Debug just wraps to make fit better with rusty syntax?
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.
Done
* Custom `Debug` impl for `DispatchError` * Implement suggestion * Display bytes if details cannot be resolved * Extract fn and use from Display impl * Display just shows {details}
* Custom `Debug` impl for `DispatchError` * Implement suggestion * Display bytes if details cannot be resolved * Extract fn and use from Display impl * Display just shows {details}
Currently the
Debug
implementation prints the wholemetadata
which fills the screen and doesn't help much:This PR adds a custom
Debug
impl which instead resolves to virtualpallet
anderror
fields similar to theDisplay
impl. To know what the actual error is extremely useful 😄See also #1140 (comment)