Skip to content

Commit

Permalink
Merge pull request #3757 from anoma/brent/better-custom-tx-error
Browse files Browse the repository at this point in the history
Improve custom tx error and help msg
  • Loading branch information
mergify[bot] committed Sep 6, 2024
2 parents 521511f + 03c9cbf commit bd686dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Improve error and help messages to clarify that a .tx
file is expected as input to --tx-path for a custom tx.
([\#3757](https://github.com/anoma/namada/pull/3757))
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 @@ -3708,7 +3708,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 bd686dc

Please sign in to comment.