Skip to content

Use SolanaError instance as CU simulation failure cause#23

Merged
lorisleiva merged 1 commit intomainfrom
loris/use-solana-error-in-cu-simulation-cause
Jan 23, 2026
Merged

Use SolanaError instance as CU simulation failure cause#23
lorisleiva merged 1 commit intomainfrom
loris/use-solana-error-in-cu-simulation-cause

Conversation

@lorisleiva
Copy link
Copy Markdown
Member

@lorisleiva lorisleiva commented Jan 23, 2026

Currently, the JavaScript client uses the TransactionError as-is as the cause of the SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT error.

This is inconsistent with how @solana/kit throws SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE errors which first converts the TransactionError into a SolanaError instance. This enables users to use the @solana/errors API when catching errors (e.g. via the isSolanaError helper).

This PR fixes this by also converting the TransactionError from the simulation into a SolanaError before using it as the cause of the parent error.

Relates to anza-xyz/kit-plugins#25, anza-xyz/kit-plugins#35 and anza-xyz/kit#1230.

@lorisleiva lorisleiva marked this pull request as ready for review January 23, 2026 09:10
@lorisleiva lorisleiva requested a review from mcintyre94 January 23, 2026 09:10
Copy link
Copy Markdown
Member

@mcintyre94 mcintyre94 left a comment

Choose a reason for hiding this comment

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

Nice, thanks!

@lorisleiva lorisleiva merged commit c6b0fb0 into main Jan 23, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants