passthroughFailedTransactionPlanExecution
Call Signature
Wraps a transaction plan execution promise to return a TransactionPlanResult even on execution failure.
When a transaction plan executor throws a
SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN
error, this helper catches it and returns the TransactionPlanResult
from the error context instead of throwing.
This allows us to handle the result of an execution in a single unified way
instead of using try/catch and examine the TransactionPlanResult in both
success and failure cases.
Any other errors are re-thrown as normal.
Parameters
| Parameter | Type | Description |
|---|---|---|
promise | Promise<Readonly<{ kind: "single"; message: TransactionMessage & TransactionMessageWithFeePayer<string>; status: TransactionPlanResultStatus<TransactionPlanResultContext>; }>> | A promise returned by a transaction plan executor. |
Returns
Promise<Readonly<{
kind: "single";
message: TransactionMessage & TransactionMessageWithFeePayer<string>;
status: TransactionPlanResultStatus<TransactionPlanResultContext>;
}>>
A promise that resolves to the transaction plan result, even if some transactions failed.
Example
Handling failures using a single result object:
See
Call Signature
Wraps a transaction plan execution promise to return a TransactionPlanResult even on execution failure.
When a transaction plan executor throws a
SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN
error, this helper catches it and returns the TransactionPlanResult
from the error context instead of throwing.
This allows us to handle the result of an execution in a single unified way
instead of using try/catch and examine the TransactionPlanResult in both
success and failure cases.
Any other errors are re-thrown as normal.
Parameters
| Parameter | Type | Description |
|---|---|---|
promise | Promise<TransactionPlanResult> | A promise returned by a transaction plan executor. |
Returns
Promise<TransactionPlanResult>
A promise that resolves to the transaction plan result, even if some transactions failed.
Example
Handling failures using a single result object: