Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Cli: Decode known program custom errors returned from simulation #17652

Merged
merged 1 commit into from
Jun 2, 2021

Conversation

CriesofCarrots
Copy link
Contributor

Problem

CLI actions may return cryptic error codes, even though the CLI knows how to decode the errors for all the programs it supports.

Summary of Changes

Add handling for RpcSimulateTransactionResult > InstructionError > Custom

Fixes #17637

Copy link
Contributor

@t-nelson t-nelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Comment on lines +1960 to +1974
// If transaction simulation returns a known Custom InstructionError, decode it
if let ClientErrorKind::RpcError(RpcError::RpcResponseError {
data:
RpcResponseErrorData::SendTransactionPreflightFailure(
RpcSimulateTransactionResult {
err:
Some(TransactionError::InstructionError(
_,
InstructionError::Custom(code),
)),
..
},
),
..
}) = err.kind()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a mouthful! 😂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, I know! 😳

@CriesofCarrots
Copy link
Contributor Author

CI error is unrelated (#17655 )

@CriesofCarrots CriesofCarrots merged commit b7f98ea into solana-labs:master Jun 2, 2021
mergify bot pushed a commit that referenced this pull request Jun 2, 2021
mergify bot added a commit that referenced this pull request Jun 2, 2021
) (#17658)

(cherry picked from commit b7f98ea)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
@CriesofCarrots CriesofCarrots deleted the cli-simulation branch July 28, 2021 22:32
@brooksprumo brooksprumo mentioned this pull request Aug 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI doesn't decode transaction simulation errors
2 participants