AURA

Errors

Parse Anchor program errors into typed AURA error codes.

The errors namespace turns raw Anchor/RPC failures into typed AURA error codes. All 140 program errors are mirrored in AuraErrorCode and AURA_ERROR_DEFINITIONS, generated directly from the IDL.

AuraErrorCode

A TypeScript enum mapping every error name to its on-chain code.

import { AuraErrorCode } from "@aura-protocol/sdk-ts";

AuraErrorCode.ExecutionPaused;       // e.g. 6000-range custom code
AuraErrorCode.NoPendingTransaction;

AURA_ERROR_DEFINITIONS is the full table — { code, name, message }[] — handy for building error dictionaries or UI lookups.

getAuraErrorCode

Extracts a numeric error code from the many shapes Anchor and @solana/web3.js throw — AnchorError, { code }, { error: { errorCode: { number } } }, or a custom program error: 0x... message string. Returns null when no code is found.

import { getAuraErrorCode } from "@aura-protocol/sdk-ts";

try {
  await instructions.execution.sendProposeTransaction(client, ai, input);
} catch (err) {
  const code = getAuraErrorCode(err); // number | null
}

parseAuraError

Resolves an error to its AURA_ERROR_DEFINITIONS entry ({ code, name, message }), or null if the code isn't an AURA error.

import { parseAuraError } from "@aura-protocol/sdk-ts";

const parsed = parseAuraError(err);
if (parsed) {
  console.error(`${parsed.name} (#${parsed.code}): ${parsed.message}`);
}

isAuraError

A boolean guard — optionally narrowed to a specific code.

import { isAuraError, AuraErrorCode } from "@aura-protocol/sdk-ts";

if (isAuraError(err, AuraErrorCode.ExecutionPaused)) {
  // treasury is paused — surface a resume action
}

if (isAuraError(err)) {
  // any known AURA error
}

Codes that aren't AURA errors (system program, compute budget, RPC transport, etc.) return null/false — handle those with your normal error paths.

On this page