Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Feature Request] Return more structured error for submit_and_wait_bcs when transaction failed. #15662

Open
fgfm999 opened this issue Dec 30, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@fgfm999
Copy link
Contributor

fgfm999 commented Dec 30, 2024

🚀 Feature Request

Return a more structured error for submit_and_wait_bcs instead of Unknown(anyhow::Error) when transaction failed.

Motivation

Currently submit_and_wait_bcs will return Unknown(anyhow::Error) when transaction failed, which I can only use Regexp to match the string part to identify the actually error.

match result {
  Ok(tx_data) => {}
  Err(RestError::Unknown(e)) if e.to_string().contains(INSUFFICIENT_BALANCE) => {}
  Err(RestError::Unknown(e)) if e.to_string().contains(TOO_MANY_STEPS) => {}

Pitch

I hope the error can hold something like ExecutionStatus

   match resp.info.status() {
            ExecutionStatus::Success => {}
            ExecutionStatus::OutOfGas => {}
            ExecutionStatus::MoveAbort { code, info, .. } => match info {
            }
            _ => {}
   }
}
@fgfm999 fgfm999 added the enhancement New feature or request label Dec 30, 2024
@fgfm999 fgfm999 changed the title [Feature Request] Return more structured for submit_and_wait_bcs when ransaction failed. [Feature Request] Return more structured error for submit_and_wait_bcs when transaction failed. Dec 30, 2024
@aptos-labs aptos-labs deleted a comment Jan 5, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant