Skip to content

Commit

Permalink
[CLI] set error_prefix to Error (#728)
Browse files Browse the repository at this point in the history
* [CLI] set error_prefix to Error

* [gh-664 and gh-663] add error prefix condition.

---------

Co-authored-by: Feliciss <[email protected]>
  • Loading branch information
jolestar and Feliciss authored Sep 6, 2023
1 parent 91e1a8c commit 948596c
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions crates/rooch/src/commands/move_cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,30 @@ impl CommandAction<String> for MoveCli {
.execute(move_args.package_path, move_args.build_config)
.map(|_| "Success".to_owned())
.map_err(RoochError::from),
MoveCommand::Errmap(c) => c
.execute(move_args.package_path, move_args.build_config)
.map(|_| "Success".to_owned())
.map_err(RoochError::from),
MoveCommand::Errmap(mut c) => {
match c.error_prefix {
Some(prefix) => {
if prefix == "Error" {
c.error_prefix = Some("Error".to_owned());
} else if prefix == "E" {
c.error_prefix = Some("E".to_owned());
} else {
return Err(RoochError::CommandArgumentError(
"Invalid error prefix. Use --error-prefix \"E\" for move-stdlib, --error-prefix \"Error\" for moveos-stdlib and rooch-framework, etc.".to_owned(),
));
}
}
None => {
return Err(RoochError::CommandArgumentError(
"Error prefix not provided. Use --error-prefix \"E\" for move-stdlib, --error-prefix \"Error\" for moveos-stdlib and rooch-framework, etc.".to_owned(),
));
}
}

c.execute(move_args.package_path, move_args.build_config)
.map(|_| "Success".to_owned())
.map_err(RoochError::from)
}
MoveCommand::Info(c) => c
.execute(move_args.package_path, move_args.build_config)
.map(|_| "Success".to_owned())
Expand Down

0 comments on commit 948596c

Please sign in to comment.