Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! [CLI] Add clever error support to Sui CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
tzakian committed Jun 17, 2024
1 parent 82ef9af commit 575354f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions crates/sui/tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3730,8 +3730,10 @@ async fn test_clever_errors() -> Result<(), anyhow::Error> {
.unwrap();

let elide_transaction_digest = |s: String| -> String {
let mut x = s.splitn(3, '\'').collect::<Vec<_>>();
x[1] = "<ELIDED_TRANSACTION_DIGEST>";
let mut x = s.splitn(5, '\'').collect::<Vec<_>>();
x[1] = "ELIDED_TRANSACTION_DIGEST";
let tmp = format!("ELIDED_ADDRESS{}", &x[3][66..]);
x[3] = &tmp;
x.join("'")
};

Expand Down
8 changes: 4 additions & 4 deletions crates/sui/tests/snapshots/cli_tests__body_fn.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ expression: error_string
---
Non-clever-abort
---
Error executing transaction '<ELIDED_TRANSACTION_DIGEST>': 1st command aborted within function '0x04becddebc3ae9e7e48c3f31144860e0f99a7414e533716a16db14a831ac4be6::clever_errors::aborter' at instruction 1 with code 0
Error executing transaction 'ELIDED_TRANSACTION_DIGEST': 1st command aborted within function 'ELIDED_ADDRESS::clever_errors::aborter' at instruction 1 with code 0
---
Line-only-abort
---
Error executing transaction '<ELIDED_TRANSACTION_DIGEST>': 1st command aborted within function '0x04becddebc3ae9e7e48c3f31144860e0f99a7414e533716a16db14a831ac4be6::clever_errors::aborter_line_no' at line 18
Error executing transaction 'ELIDED_TRANSACTION_DIGEST': 1st command aborted within function 'ELIDED_ADDRESS::clever_errors::aborter_line_no' at line 18
---
Clever-error-utf8
---
Error executing transaction '<ELIDED_TRANSACTION_DIGEST>': 1st command aborted within function '0x04becddebc3ae9e7e48c3f31144860e0f99a7414e533716a16db14a831ac4be6::clever_errors::clever_aborter' at line 22. Aborted with 'ENotFound' -- 'Element not found in vector 💥 🚀 🌠'
Error executing transaction 'ELIDED_TRANSACTION_DIGEST': 1st command aborted within function 'ELIDED_ADDRESS::clever_errors::clever_aborter' at line 22. Aborted with 'ENotFound' -- 'Element not found in vector 💥 🚀 🌠'
---
Clever-error-non-utf8
---
Error executing transaction '<ELIDED_TRANSACTION_DIGEST>': 1st command aborted within function '0x04becddebc3ae9e7e48c3f31144860e0f99a7414e533716a16db14a831ac4be6::clever_errors::clever_aborter_not_a_string' at line 26. Aborted with 'ENotAString' -- 'BAEAAAAAAAAAAgAAAAAAAAADAAAAAAAAAAQAAAAAAAAA'
Error executing transaction 'ELIDED_TRANSACTION_DIGEST': 1st command aborted within function 'ELIDED_ADDRESS::clever_errors::clever_aborter_not_a_string' at line 26. Aborted with 'ENotAString' -- 'BAEAAAAAAAAAAgAAAAAAAAADAAAAAAAAAAQAAAAAAAAA'
---

0 comments on commit 575354f

Please sign in to comment.