-
Notifications
You must be signed in to change notification settings - Fork 35
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
feat: improve errors in the CLI #682
Conversation
be14a21
to
5c8c5b7
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.
Looks good overall! I haven't finished looking at all the files yet but leaving some comments for now
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.
Leaving some comments, the only big one being related to not losing source error information on places where we do err.to_string()
. This might have some more information.
Other than that, I think that this is a great improvement over the current CLI errors and so we could merge this after having revised that aspect.
a1e39d8
to
8bfbd65
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.
LGTM! Left just one comment about refactoring the display implementations for errors with source
bin/miden-cli/src/errors.rs
Outdated
|
||
#[derive(Debug, Diagnostic, Error)] | ||
pub enum CliError { | ||
#[error("account error: {1} with error {0}")] |
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 here (and in the other similar variants), showing the source error (ie, displaying {1}
) is redundant because error reporters will automatically report the source errors as part of the output. We could test this by inducing an error (randomly picked one):
Error: cli::account_error
× account error: error executing command with error storage slot at index 5 is not of type
│ map
╰─▶ storage slot at index 5 is not of type map
So I think we could just display the String as the top-level reason why the command failed, and then the source error.
528edbc
to
f271502
Compare
closes #369
Current state of the errors: