createFailedToExecuteTransactionPlanError

function createFailedToExecuteTransactionPlanError<TContext>(
    result,
    abortReason?,
): SolanaError<7618003>;

Creates a SolanaError with the SOLANA_ERROR__INSTRUCTION_PLANS__FAILED_TO_EXECUTE_TRANSACTION_PLAN error code from a TransactionPlanResult.

This is a low-level error intended for custom transaction plan executor authors. It attaches the full transactionPlanResult as a non-enumerable property so that callers can inspect execution details without the result being serialized with the error.

Type Parameters

Type ParameterDefault typeDescription
TContext extends TransactionPlanResultContextTransactionPlanResultContextWithSignatureThe type of the context object attached to the results. Any context is accepted, since this helper never reads from it.

Parameters

ParameterTypeDescription
resultTransactionPlanResult<TContext>The full transaction plan result tree.
abortReason?unknownAn optional abort reason if the plan was aborted.

Returns

SolanaError<7618003>

A SolanaError with the appropriate error code and context.

Example

Throwing a failed-to-execute error from a custom executor.

import { createFailedToExecuteTransactionPlanError } from '@solana/instruction-plans';
 
throw createFailedToExecuteTransactionPlanError(transactionPlanResult, abortSignal?.reason);

See

On this page