Encapsulates an error's stacktrace, a Solana-specific numeric code that indicates what went wrong, and optional context if the type of error indicated by the code supports it.

Type Parameters

  • TErrorCode extends SolanaErrorCode = SolanaErrorCode

Hierarchy

  • Error
    • SolanaError

Constructors

  • Type Parameters

    • TErrorCode extends SolanaErrorCode = SolanaErrorCode

    Parameters

    • Rest...__namedParameters: ReadonlyContextValue<DefaultUnspecifiedErrorContextToUndefined<BasicInstructionErrorContext<
              | 4615000
              | 4615001
              | 4615002
              | 4615003
              | 4615004
              | 4615005
              | 4615006
              | 4615007
              | 4615008
              | 4615009
              | 4615010
              | 4615011
              | 4615012
              | 4615013
              | 4615014
              | 4615015
              | 4615016
              | 4615017
              | 4615018
              | 4615019
              | 4615020
              | 4615021
              | 4615022
              | 4615023
              | 4615024
              | 4615025
              | 4615026
              | 4615027
              | 4615028
              | 4615029
              | 4615030
              | 4615031
              | 4615032
              | 4615033
              | 4615034
              | 4615035
              | 4615036
              | 4615037
              | 4615038
              | 4615039
              | 4615040
              | 4615041
              | 4615042
              | 4615043
              | 4615044
              | 4615045
              | 4615046
              | 4615047
              | 4615048
              | 4615049
              | 4615050
              | 4615051
              | 4615052
              | 4615053
              | 4615054> & {
              -32001: {
                  __serverMessage: string;
              };
              -32002: Omit<RpcSimulateTransactionResult, "err">;
              -32004: {
                  __serverMessage: string;
              };
              -32005: {
                  numSlotsBehind?: number;
              };
              -32006: {
                  __serverMessage: string;
              };
              -32007: {
                  __serverMessage: string;
              };
              -32009: {
                  __serverMessage: string;
              };
              -32010: {
                  __serverMessage: string;
              };
              -32012: {
                  __serverMessage: string;
              };
              -32014: {
                  __serverMessage: string;
              };
              -32015: {
                  __serverMessage: string;
              };
              -32016: {
                  contextSlot: bigint;
              };
              -32017: {
                  currentBlockHeight: bigint;
                  rewardsCompleteBlockHeight: bigint;
                  slot: bigint;
              };
              -32018: {
                  slot: bigint;
              };
              -32600: {
                  __serverMessage: string;
              };
              -32601: {
                  __serverMessage: string;
              };
              -32602: {
                  __serverMessage: string;
              };
              -32603: {
                  __serverMessage: string;
              };
              -32700: {
                  __serverMessage: string;
              };
              1: {
                  currentBlockHeight: bigint;
                  lastValidBlockHeight: bigint;
              };
              10: {
                  error: unknown;
                  message: string;
              };
              11: {
                  causeMessage: string;
                  logs?: readonly string[];
                  preflightData?: Omit<RpcSimulateTransactionResult, "err">;
                  transactionPlanResult: unknown;
              };
              12: {
                  causeMessages: string;
                  failedTransactions: readonly {
                      error: Error;
                      index: number;
                      logs?: readonly (...)[];
                      preflightData?: Omit<(...), (...)>;
                  }[];
                  transactionPlanResult: unknown;
              };
              2: {
                  actualNonceValue: string;
                  expectedNonceValue: string;
              };
              2800000: {
                  actualLength: number;
              };
              2800001: {
                  actualLength: number;
              };
              2800002: {
                  putativeAddress: string;
              };
              2800005: {
                  bump: number;
              };
              2800006: {
                  actual: number;
                  maxSeeds: number;
              };
              2800007: {
                  actual: number;
                  index: number;
                  maxSeedLength: number;
              };
              3: {
                  nonceAccountAddress: string;
              };
              3230000: {
                  address: string;
              };
              32300001: {
                  addresses: readonly string[];
              };
              3230002: {
                  address: string;
              };
              3230003: {
                  address: string;
              };
              3230004: {
                  addresses: readonly string[];
              };
              3610007: {
                  key: CryptoKey;
              };
              3704000: {
                  byteLength: number;
              };
              3704001: {
                  actualLength: number;
              };
              3704002: {
                  actualLength: number;
              };
              3704003: {
                  actualLength: number;
              };
              4: {
                  actualLength: number;
              };
              4128000: {
                  data?: ReadonlyUint8Array;
                  programAddress: string;
              };
              4128001: {
                  accountAddresses?: readonly string[];
                  programAddress: string;
              };
              4128002: {
                  actualProgramAddress: string;
                  expectedProgramAddress: string;
              };
              4615000: {
                  errorName: string;
                  index: number;
                  instructionErrorContext?: unknown;
              };
              4615026: {
                  code: number;
                  index: number;
              };
              4615045: {
                  index: number;
              };
              5: {
                  actualLength: number;
              };
              5508000: {
                  address: string;
              };
              5508001: {
                  address: string;
              };
              5508002: {
                  address: string;
              };
              5508003: {
                  address: string;
              };
              5508004: {
                  address: string;
              };
              5508005: {
                  address: string;
              };
              5508006: {
                  address: string;
              };
              5508007: {
                  address: string;
              };
              5508008: {
                  address: string;
              };
              5508012: {
                  address: string;
                  supportedFeatures: string[];
              };
              5607000: {
                  actualBytes: number;
                  maxBytes: number;
              };
              5607002: {
                  actualLength: number;
              };
              5607003: {
                  actualLength: number;
              };
              5607004: {
                  numRequiredSignatures: number;
                  signatoryAddresses: readonly string[];
                  signaturesLength: number;
              };
              5607006: {
                  unsupportedVersion: number;
              };
              5607007: {
                  actualMessageFormat: number;
                  expectedMessageFormat: number;
              };
              5607008: {
                  actualLength: number;
                  specifiedLength: number;
              };
              5607011: {
                  addresses: readonly string[];
              };
              5607012: {
                  missingRequiredSigners: readonly string[];
                  unexpectedSigners: readonly string[];
              };
              5607013: {
                  expectedAddresses: readonly string[];
                  unexpectedAddresses: readonly string[];
              };
              5607014: {
                  actualVersion: number;
                  expectedVersion: number;
              };
              5607017: {
                  signatoriesWithInvalidSignatures: readonly string[];
                  signatoriesWithMissingSignatures: readonly string[];
              };
              5663000: {
                  programAddress: string;
              };
              5663001: {
                  programAddress: string;
              };
              5663004: {
                  actualVersion: number;
              };
              5663005: {
                  lookupTableAddresses: readonly string[];
              };
              5663006: {
                  highestKnownIndex: number;
                  highestRequestedIndex: number;
                  lookupTableAddress: string;
              };
              5663007: {
                  index: number;
              };
              5663009: {
                  addresses: readonly string[];
              };
              5663010: {
                  index: number;
              };
              5663015: {
                  expectedAddresses: readonly string[];
                  unexpectedAddresses: readonly string[];
              };
              5663017: {
                  numRequiredSignatures: number;
                  signaturesLength: number;
                  signerAddresses: readonly string[];
              };
              5663019: Omit<RpcSimulateTransactionResult, "err">;
              5663020: {
                  transactionSize: number;
                  transactionSizeLimit: number;
              };
              5663021: {
                  unsupportedVersion: number;
              };
              5663022: {
                  nonce: string;
              };
              5663023: {
                  messageBytes: ReadonlyUint8Array;
              };
              5663026: {
                  firstByte: number;
                  transactionBytes: ReadonlyUint8Array;
              };
              5663027: {
                  numExpectedSignatures: number;
                  transactionBytes: ReadonlyUint8Array;
                  transactionBytesLength: number;
              };
              5663028: {
                  mask: number;
              };
              5663029: {
                  nonce: string;
                  nonceAccountIndex: number;
                  numberOfStaticAccounts: number;
              };
              5663030: {
                  actualKind: "u32" | "u64";
                  configName: string;
                  expectedKind: "u32" | "u64";
              };
              5663031: {
                  numInstructionHeaders: number;
                  numInstructionPayloads: number;
              };
              7: {
                  value: string;
              };
              7050000: {
                  errorName: string;
                  transactionErrorContext?: unknown;
              };
              7050030: {
                  index: number;
              };
              7050031: {
                  accountIndex: number;
              };
              7050035: {
                  accountIndex: number;
              };
              7618000: {
                  numBytesRequired: number;
                  numFreeBytes: number;
              };
              7618003: {
                  abortReason?: unknown;
                  transactionPlanResult: unknown;
              };
              7618005: {
                  transactionPlanResult: unknown;
              };
              7618006: {
                  actualKind: string;
                  expectedKind: string;
                  instructionPlan: unknown;
              };
              7618007: {
                  actualKind: string;
                  expectedKind: string;
                  transactionPlan: unknown;
              };
              7618008: {
                  actualKind: string;
                  expectedKind: string;
                  transactionPlanResult: unknown;
              };
              7618009: {
                  transactionPlanResult: unknown;
              };
              8: {
                  value: string;
              };
              8078000: {
                  codecDescription: string;
              };
              8078001: {
                  bytesLength: number;
                  codecDescription: string;
                  expected: number;
              };
              8078005: {
                  decoderFixedSize: number;
                  encoderFixedSize: number;
              };
              8078006: {
                  decoderMaxSize: undefined | number;
                  encoderMaxSize: undefined | number;
              };
              8078007: {
                  actual: number | bigint;
                  codecDescription: string;
                  expected: number | bigint;
              };
              8078008: {
                  discriminator: number | bigint;
                  formattedValidDiscriminators: string;
                  validDiscriminators: readonly number[];
              };
              8078009: {
                  value:
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean;
                  variants: readonly (
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean)[];
              };
              8078010: {
                  formattedNumericalValues: string;
                  numericalValues: readonly number[];
                  stringValues: readonly string[];
                  variant: string | number | symbol;
              };
              8078011: {
                  codecDescription: string;
                  max: number | bigint;
                  min: number | bigint;
                  value: number | bigint;
              };
              8078012: {
                  alphabet: string;
                  base: number;
                  value: string;
              };
              8078013: {
                  bytesLength: number;
                  codecDescription: string;
              };
              8078014: {
                  bytesLength: number;
                  codecDescription: string;
                  offset: number;
              };
              8078015: {
                  value:
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean;
                  variants: readonly (
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean)[];
              };
              8078016: {
                  discriminator: number | bigint;
                  maxRange: number;
                  minRange: number;
              };
              8078017: {
                  maxRange: number;
                  minRange: number;
                  variant: number;
              };
              8078018: {
                  constant: ReadonlyUint8Array;
                  data: ReadonlyUint8Array;
                  hexConstant: string;
                  hexData: string;
                  offset: number;
              };
              8078019: {
                  codecDescription: string;
                  expectedSize: number;
                  hexZeroValue: string;
                  zeroValue: ReadonlyUint8Array;
              };
              8078020: {
                  encodedBytes: ReadonlyUint8Array;
                  hexEncodedBytes: string;
                  hexSentinel: string;
                  sentinel: ReadonlyUint8Array;
              };
              8078021: {
                  decodedBytes: ReadonlyUint8Array;
                  hexDecodedBytes: string;
                  hexSentinel: string;
                  sentinel: ReadonlyUint8Array;
              };
              8078022: {
                  stringValues: readonly string[];
              };
              8078023: {
                  expectedLength: number;
                  numExcessBytes: number;
              };
              8078025: {
                  bytes: ReadonlyUint8Array;
              };
              8100000: {
                  argumentLabel: string;
                  keyPath: readonly (string | number | symbol)[];
                  methodName: string;
                  optionalPathLabel: string;
                  path?: string;
                  value: bigint;
              };
              8100001: {
                  headers: readonly string[];
              };
              8100002: {
                  headers: Headers;
                  message: string;
                  statusCode: number;
              };
              8100003: {
                  method: string;
                  params: readonly unknown[];
              };
              8190000: {
                  notificationName: string;
              };
              8190004: {
                  errorEvent: Event;
              };
              8500000: {
                  actualAccountMetas: number;
                  expectedAccountMetas: number;
              };
              8500001: {
                  instructionType: string | number;
                  programName: string;
              };
              8500002: {
                  instructionData: ReadonlyUint8Array;
                  programName: string;
              };
              8500003: {
                  expectedType: string;
                  inputName: string;
              };
              8500004: {
                  inputName: string;
              };
              8500005: {
                  accountType: string | number;
                  programName: string;
              };
              8500006: {
                  accountData: ReadonlyUint8Array;
                  programName: string;
              };
              9: {
                  value: bigint;
              };
              9900002: {
                  cacheKey: string;
              };
              9900003: {
                  unexpectedValue: unknown;
              };
              9900004: {
                  channelName: string;
                  supportedChannelNames: readonly string[];
              };
              9900005: {
                  kind: string;
              };
              9900006: {
                  kind: string;
              };
          }>>[TErrorCode] extends undefined
          ? [code: TErrorCode, errorOptions?: ErrorOptions]
          : [code: TErrorCode, contextAndErrorOptions: ReadonlyContextValue<DefaultUnspecifiedErrorContextToUndefined<BasicInstructionErrorContext<
              | 4615000
              | 4615001
              | 4615002
              | 4615003
              | 4615004
              | 4615005
              | 4615006
              | 4615007
              | 4615008
              | 4615009
              | 4615010
              | 4615011
              | 4615012
              | 4615013
              | 4615014
              | 4615015
              | 4615016
              | 4615017
              | 4615018
              | 4615019
              | 4615020
              | 4615021
              | 4615022
              | 4615023
              | 4615024
              | 4615025
              | 4615026
              | 4615027
              | 4615028
              | 4615029
              | 4615030
              | 4615031
              | 4615032
              | 4615033
              | 4615034
              | 4615035
              | 4615036
              | 4615037
              | 4615038
              | 4615039
              | 4615040
              | 4615041
              | 4615042
              | 4615043
              | 4615044
              | 4615045
              | 4615046
              | 4615047
              | 4615048
              | 4615049
              | 4615050
              | 4615051
              | 4615052
              | 4615053
              | 4615054> & {
              -32001: {
                  __serverMessage: string;
              };
              -32002: Omit<RpcSimulateTransactionResult, "err">;
              -32004: {
                  __serverMessage: string;
              };
              -32005: {
                  numSlotsBehind?: number;
              };
              -32006: {
                  __serverMessage: string;
              };
              -32007: {
                  __serverMessage: string;
              };
              -32009: {
                  __serverMessage: string;
              };
              -32010: {
                  __serverMessage: string;
              };
              -32012: {
                  __serverMessage: string;
              };
              -32014: {
                  __serverMessage: string;
              };
              -32015: {
                  __serverMessage: string;
              };
              -32016: {
                  contextSlot: bigint;
              };
              -32017: {
                  currentBlockHeight: bigint;
                  rewardsCompleteBlockHeight: bigint;
                  slot: bigint;
              };
              -32018: {
                  slot: bigint;
              };
              -32600: {
                  __serverMessage: string;
              };
              -32601: {
                  __serverMessage: string;
              };
              -32602: {
                  __serverMessage: string;
              };
              -32603: {
                  __serverMessage: string;
              };
              -32700: {
                  __serverMessage: string;
              };
              1: {
                  currentBlockHeight: bigint;
                  lastValidBlockHeight: bigint;
              };
              10: {
                  error: unknown;
                  message: string;
              };
              11: {
                  causeMessage: string;
                  logs?: readonly (...)[];
                  preflightData?: Omit<(...), (...)>;
                  transactionPlanResult: unknown;
              };
              12: {
                  causeMessages: string;
                  failedTransactions: readonly {
                      error: ...;
                      index: ...;
                      logs?: ...;
                      preflightData?: ...;
                  }[];
                  transactionPlanResult: unknown;
              };
              2: {
                  actualNonceValue: string;
                  expectedNonceValue: string;
              };
              2800000: {
                  actualLength: number;
              };
              2800001: {
                  actualLength: number;
              };
              2800002: {
                  putativeAddress: string;
              };
              2800005: {
                  bump: number;
              };
              2800006: {
                  actual: number;
                  maxSeeds: number;
              };
              2800007: {
                  actual: number;
                  index: number;
                  maxSeedLength: number;
              };
              3: {
                  nonceAccountAddress: string;
              };
              3230000: {
                  address: string;
              };
              32300001: {
                  addresses: readonly string[];
              };
              3230002: {
                  address: string;
              };
              3230003: {
                  address: string;
              };
              3230004: {
                  addresses: readonly string[];
              };
              3610007: {
                  key: CryptoKey;
              };
              3704000: {
                  byteLength: number;
              };
              3704001: {
                  actualLength: number;
              };
              3704002: {
                  actualLength: number;
              };
              3704003: {
                  actualLength: number;
              };
              4: {
                  actualLength: number;
              };
              4128000: {
                  data?: ReadonlyUint8Array;
                  programAddress: string;
              };
              4128001: {
                  accountAddresses?: readonly (...)[];
                  programAddress: string;
              };
              4128002: {
                  actualProgramAddress: string;
                  expectedProgramAddress: string;
              };
              4615000: {
                  errorName: string;
                  index: number;
                  instructionErrorContext?: unknown;
              };
              4615026: {
                  code: number;
                  index: number;
              };
              4615045: {
                  index: number;
              };
              5: {
                  actualLength: number;
              };
              5508000: {
                  address: string;
              };
              5508001: {
                  address: string;
              };
              5508002: {
                  address: string;
              };
              5508003: {
                  address: string;
              };
              5508004: {
                  address: string;
              };
              5508005: {
                  address: string;
              };
              5508006: {
                  address: string;
              };
              5508007: {
                  address: string;
              };
              5508008: {
                  address: string;
              };
              5508012: {
                  address: string;
                  supportedFeatures: string[];
              };
              5607000: {
                  actualBytes: number;
                  maxBytes: number;
              };
              5607002: {
                  actualLength: number;
              };
              5607003: {
                  actualLength: number;
              };
              5607004: {
                  numRequiredSignatures: number;
                  signatoryAddresses: readonly string[];
                  signaturesLength: number;
              };
              5607006: {
                  unsupportedVersion: number;
              };
              5607007: {
                  actualMessageFormat: number;
                  expectedMessageFormat: number;
              };
              5607008: {
                  actualLength: number;
                  specifiedLength: number;
              };
              5607011: {
                  addresses: readonly string[];
              };
              5607012: {
                  missingRequiredSigners: readonly string[];
                  unexpectedSigners: readonly string[];
              };
              5607013: {
                  expectedAddresses: readonly string[];
                  unexpectedAddresses: readonly string[];
              };
              5607014: {
                  actualVersion: number;
                  expectedVersion: number;
              };
              5607017: {
                  signatoriesWithInvalidSignatures: readonly string[];
                  signatoriesWithMissingSignatures: readonly string[];
              };
              5663000: {
                  programAddress: string;
              };
              5663001: {
                  programAddress: string;
              };
              5663004: {
                  actualVersion: number;
              };
              5663005: {
                  lookupTableAddresses: readonly string[];
              };
              5663006: {
                  highestKnownIndex: number;
                  highestRequestedIndex: number;
                  lookupTableAddress: string;
              };
              5663007: {
                  index: number;
              };
              5663009: {
                  addresses: readonly string[];
              };
              5663010: {
                  index: number;
              };
              5663015: {
                  expectedAddresses: readonly string[];
                  unexpectedAddresses: readonly string[];
              };
              5663017: {
                  numRequiredSignatures: number;
                  signaturesLength: number;
                  signerAddresses: readonly string[];
              };
              5663019: Omit<RpcSimulateTransactionResult, "err">;
              5663020: {
                  transactionSize: number;
                  transactionSizeLimit: number;
              };
              5663021: {
                  unsupportedVersion: number;
              };
              5663022: {
                  nonce: string;
              };
              5663023: {
                  messageBytes: ReadonlyUint8Array;
              };
              5663026: {
                  firstByte: number;
                  transactionBytes: ReadonlyUint8Array;
              };
              5663027: {
                  numExpectedSignatures: number;
                  transactionBytes: ReadonlyUint8Array;
                  transactionBytesLength: number;
              };
              5663028: {
                  mask: number;
              };
              5663029: {
                  nonce: string;
                  nonceAccountIndex: number;
                  numberOfStaticAccounts: number;
              };
              5663030: {
                  actualKind: "u32" | "u64";
                  configName: string;
                  expectedKind: "u32" | "u64";
              };
              5663031: {
                  numInstructionHeaders: number;
                  numInstructionPayloads: number;
              };
              7: {
                  value: string;
              };
              7050000: {
                  errorName: string;
                  transactionErrorContext?: unknown;
              };
              7050030: {
                  index: number;
              };
              7050031: {
                  accountIndex: number;
              };
              7050035: {
                  accountIndex: number;
              };
              7618000: {
                  numBytesRequired: number;
                  numFreeBytes: number;
              };
              7618003: {
                  abortReason?: unknown;
                  transactionPlanResult: unknown;
              };
              7618005: {
                  transactionPlanResult: unknown;
              };
              7618006: {
                  actualKind: string;
                  expectedKind: string;
                  instructionPlan: unknown;
              };
              7618007: {
                  actualKind: string;
                  expectedKind: string;
                  transactionPlan: unknown;
              };
              7618008: {
                  actualKind: string;
                  expectedKind: string;
                  transactionPlanResult: unknown;
              };
              7618009: {
                  transactionPlanResult: unknown;
              };
              8: {
                  value: string;
              };
              8078000: {
                  codecDescription: string;
              };
              8078001: {
                  bytesLength: number;
                  codecDescription: string;
                  expected: number;
              };
              8078005: {
                  decoderFixedSize: number;
                  encoderFixedSize: number;
              };
              8078006: {
                  decoderMaxSize: undefined | number;
                  encoderMaxSize: undefined | number;
              };
              8078007: {
                  actual: number | bigint;
                  codecDescription: string;
                  expected: number | bigint;
              };
              8078008: {
                  discriminator: number | bigint;
                  formattedValidDiscriminators: string;
                  validDiscriminators: readonly number[];
              };
              8078009: {
                  value:
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean;
                  variants: readonly (
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...))[];
              };
              8078010: {
                  formattedNumericalValues: string;
                  numericalValues: readonly number[];
                  stringValues: readonly string[];
                  variant: string | number | symbol;
              };
              8078011: {
                  codecDescription: string;
                  max: number | bigint;
                  min: number | bigint;
                  value: number | bigint;
              };
              8078012: {
                  alphabet: string;
                  base: number;
                  value: string;
              };
              8078013: {
                  bytesLength: number;
                  codecDescription: string;
              };
              8078014: {
                  bytesLength: number;
                  codecDescription: string;
                  offset: number;
              };
              8078015: {
                  value:
                      | undefined
                      | null
                      | string
                      | number
                      | bigint
                      | boolean;
                  variants: readonly (
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...)
                      | (...))[];
              };
              8078016: {
                  discriminator: number | bigint;
                  maxRange: number;
                  minRange: number;
              };
              8078017: {
                  maxRange: number;
                  minRange: number;
                  variant: number;
              };
              8078018: {
                  constant: ReadonlyUint8Array;
                  data: ReadonlyUint8Array;
                  hexConstant: string;
                  hexData: string;
                  offset: number;
              };
              8078019: {
                  codecDescription: string;
                  expectedSize: number;
                  hexZeroValue: string;
                  zeroValue: ReadonlyUint8Array;
              };
              8078020: {
                  encodedBytes: ReadonlyUint8Array;
                  hexEncodedBytes: string;
                  hexSentinel: string;
                  sentinel: ReadonlyUint8Array;
              };
              8078021: {
                  decodedBytes: ReadonlyUint8Array;
                  hexDecodedBytes: string;
                  hexSentinel: string;
                  sentinel: ReadonlyUint8Array;
              };
              8078022: {
                  stringValues: readonly string[];
              };
              8078023: {
                  expectedLength: number;
                  numExcessBytes: number;
              };
              8078025: {
                  bytes: ReadonlyUint8Array;
              };
              8100000: {
                  argumentLabel: string;
                  keyPath: readonly ((...) | (...) | (...))[];
                  methodName: string;
                  optionalPathLabel: string;
                  path?: string;
                  value: bigint;
              };
              8100001: {
                  headers: readonly string[];
              };
              8100002: {
                  headers: Headers;
                  message: string;
                  statusCode: number;
              };
              8100003: {
                  method: string;
                  params: readonly unknown[];
              };
              8190000: {
                  notificationName: string;
              };
              8190004: {
                  errorEvent: Event;
              };
              8500000: {
                  actualAccountMetas: number;
                  expectedAccountMetas: number;
              };
              8500001: {
                  instructionType: string | number;
                  programName: string;
              };
              8500002: {
                  instructionData: ReadonlyUint8Array;
                  programName: string;
              };
              8500003: {
                  expectedType: string;
                  inputName: string;
              };
              8500004: {
                  inputName: string;
              };
              8500005: {
                  accountType: string | number;
                  programName: string;
              };
              8500006: {
                  accountData: ReadonlyUint8Array;
                  programName: string;
              };
              9: {
                  value: bigint;
              };
              9900002: {
                  cacheKey: string;
              };
              9900003: {
                  unexpectedValue: unknown;
              };
              9900004: {
                  channelName: string;
                  supportedChannelNames: readonly string[];
              };
              9900005: {
                  kind: string;
              };
              9900006: {
                  kind: string;
              };
          }>>[TErrorCode] & (undefined | ErrorOptions)]

    Returns SolanaError<TErrorCode>

Properties

cause?: TErrorCode extends SolanaErrorCodeWithCause
    ? SolanaError<SolanaErrorCode>
    : unknown

Indicates the root cause of this SolanaError, if any.

For example, a transaction error might have an instruction error as its root cause. In this case, you will be able to access the instruction error on the transaction error as cause.

context: SolanaErrorCodedContext[TErrorCode]

Contains context that can assist in understanding or recovering from a SolanaError.

message: string
name: string
stack?: string
stackTraceLimit: number

The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)).

The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed.

If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

Methods

  • Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.

    const myObject = {};
    Error.captureStackTrace(myObject);
    myObject.stack; // Similar to `new Error().stack`

    The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}.

    The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace.

    The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:

    function a() {
    b();
    }

    function b() {
    c();
    }

    function c() {
    // Create an error without stack trace to avoid calculating the stack trace twice.
    const { stackTraceLimit } = Error;
    Error.stackTraceLimit = 0;
    const error = new Error();
    Error.stackTraceLimit = stackTraceLimit;

    // Capture the stack trace above function b
    Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
    throw error;
    }

    a();

    Parameters

    • targetObject: object
    • OptionalconstructorOpt: Function

    Returns void