Skip to content

Commit

Permalink
improve custom tx error and help msg
Browse files Browse the repository at this point in the history
  • Loading branch information
brentstone committed Sep 5, 2024
1 parent ac24f58 commit c4e9de4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion crates/apps_lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4483,7 +4483,11 @@ pub mod args {
.arg(
TX_PATH_OPT
.def()
.help(wrap!("The path to a serialized transaction."))
.help(wrap!(
"The path to a serialized transaction. It is \
expected that this transaction is contained in a \
.tx file, typically produced from a tx dump."
))
.conflicts_with_all([
CODE_PATH_OPT.name,
DATA_PATH_OPT.name,
Expand Down
7 changes: 6 additions & 1 deletion crates/sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,12 @@ pub async fn build_custom(

let mut tx = if let Some(serialized_tx) = serialized_tx {
Tx::deserialize(serialized_tx.as_ref()).map_err(|_| {
Error::Other("Invalid tx deserialization.".to_string())
Error::Other(
"Invalid tx deserialization. Please make sure you are passing \
a file in .tx format, typically produced from using the \
`--dump-tx` flag."
.to_string(),
)
})?
} else {
let code_path = code_path
Expand Down

0 comments on commit c4e9de4

Please sign in to comment.