getFirstFailedSingleTransactionPlanResult
Retrieves the first failed transaction plan result from a transaction plan result tree.
This function searches the transaction plan result tree using a depth-first traversal and returns the first single transaction result with a 'failed' status. If no failed result is found, it throws a SolanaError.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
TContext extends TransactionPlanResultContext | TransactionPlanResultContext | The type of the context object that may be passed along with results |
TTransactionMessage extends TransactionMessage & TransactionMessageWithFeePayer<string> | TransactionMessage & TransactionMessageWithFeePayer<string> | The type of the transaction message |
Parameters
| Parameter | Type | Description |
|---|---|---|
transactionPlanResult | TransactionPlanResult<TContext, TTransactionMessage> | The transaction plan result tree to search. |
Returns
FailedSingleTransactionPlanResult<TContext, TTransactionMessage>
The first failed single transaction plan result.
Throws
Throws a SolanaError with code
SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_SINGLE_TRANSACTION_PLAN_RESULT_NOT_FOUND if no
failed transaction plan result is found. The error context contains a non-enumerable
transactionPlanResult property for recovery purposes.
Example
Retrieving the first failed result from a parallel execution.