Skip to content
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

[CLI] set error_prefix to Error #728

Merged
merged 2 commits into from
Sep 6, 2023
Merged

[CLI] set error_prefix to Error #728

merged 2 commits into from
Sep 6, 2023

Conversation

jolestar
Copy link
Contributor

@jolestar jolestar commented Aug 30, 2023

Summary

Set rooch move errmap error_prefix default to Error. Follow #664 , Ref #663

@vercel
Copy link

vercel bot commented Aug 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Aug 30, 2023 6:36pm

@jolestar jolestar requested a review from feliciss August 30, 2023 12:00
.map(|_| "Success".to_owned())
.map_err(RoochError::from),
MoveCommand::Errmap(mut c) => {
c.error_prefix = Some("Error".to_owned());
Copy link
Collaborator

@feliciss feliciss Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using rooch move errmap for move-stdlib. It will be Success and generate an empty file. I'll add a fix to it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If users don't specify --error-prefix flag, simply throw an error. For instance, in rooch-framework directory:

rooch move errmap
Invalid arguments: Error prefix not provided. Use --error-prefix "E" for move-stdlib, --error-prefix "Error" for moveos-stdlib and rooch-framework, etc.

rooch move errmap --error-prefix "A"
Invalid arguments: Invalid error prefix. Use --error-prefix "E" for move-stdlib, --error-prefix "Error" for moveos-stdlib and rooch-framework, etc.

rooch move errmap --error-prefix "E"
thread 'main' panicked at 'called Result::unwrap() on an Err value: Duplicate entry for abort code 1 found in 0000000000000000000000000000000000000000000000000000000000000003::ecdsa_k1, previous entry: ErrorDescription {
code_name: "ECDSA_K1_TO_SCHEME_BITCOIN_LENGTH",
code_description: " constant codes",
}', /Users/system/.cargo/git/checkouts/move-d59e49550a684528/782ed81/language/move-prover/move-errmapgen/src/errmapgen.rs:69:47
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

rooch move errmap --error-prefix "Error"
Success

Copy link
Collaborator

@feliciss feliciss Aug 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And we should also limit the scope of using E and Error for move-stdlib and moveos-stdlib:

cd move-stdlib
rooch move errmap --error-prefix "Error"
Success
rooch move errmap --error-prefix "E"
Success

It should be throwing errors for using --error-prefix "Error" for move-stdlib, cause it will be an empty file.

cd moveos-stdlib
rooch move errmap --error-prefix "E"
Success
rooch move errmap --error-prefix "Error"
Success

For moveos-stdlib, it should be throwing errors when using flag --error-prefix "E", cause it will be an error map both to E and Error.

@jolestar jolestar merged commit 948596c into main Sep 6, 2023
@jolestar jolestar deleted the cli_err_gen branch September 6, 2023 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants