isMessagePackerErrorThatRequiresNewCandidate

function isMessagePackerErrorThatRequiresNewCandidate(
    error,
): error is MessagePackerErrorThatRequiresNewCandidate;

Identifies whether an error thrown whilst packing instructions into a transaction message means that the message cannot take the instruction(s) and that a new candidate message is required.

This is the set of errors the transaction planner treats as "try another message": the message is too large, holds too many instructions, references too many accounts or signers, or was rejected by a MessagePacker for a custom reason. Any other error is unexpected and should propagate.

Parameters

ParameterType
errorunknown

Returns

error is MessagePackerErrorThatRequiresNewCandidate

Example

try {
  message = messagePacker.packMessageToCapacity(message);
} catch (error) {
  if (!isMessagePackerErrorThatRequiresNewCandidate(error)) throw error;
  message = messagePacker.packMessageToCapacity(createNewMessage());
}

On this page