@armada/sdk / index / isArmadaError
Function: isArmadaError()
Call Signature
isArmadaError(
err):err is ArmadaError
Defined in: src/errors.ts:299
Whether err is an SDK error — and, given code, one with that code (narrowed to its class, so its own fields, like RpcError.transport, are typed). Matches on the code field, so it also recognises an error from another copy of the SDK (ESM and CJS builds, or two bundled copies), where instanceof is false. Another library's error with a code field (ethers' NETWORK_ERROR, say) isn't one.
Parameters
err
unknown
Returns
err is ArmadaError
Call Signature
isArmadaError<
C>(err,code):err is ArmadaErrorByCode[C]
Defined in: src/errors.ts:300
Whether err is an SDK error — and, given code, one with that code (narrowed to its class, so its own fields, like RpcError.transport, are typed). Matches on the code field, so it also recognises an error from another copy of the SDK (ESM and CJS builds, or two bundled copies), where instanceof is false. Another library's error with a code field (ethers' NETWORK_ERROR, say) isn't one.
Type Parameters
C
C extends "ROOT_MISMATCH" | "NOTE_ALREADY_SPENT" | "FEE_QUOTE_EXPIRED" | "ARTIFACT_INTEGRITY" | "STORAGE_CONFLICT" | "STORAGE_UNAVAILABLE" | "NO_SPEND_CAPABILITY" | "INSUFFICIENT_BALANCE" | "RPC" | "QUICK_SYNC_SCHEMA" | "INDEXER_HTTP" | "POSITION_GAP" | "ARTIFACT_FETCH" | "INVALID_KEY_MATERIAL" | "PROOF_VERIFICATION" | "UNSUPPORTED_CIRCUIT_SHAPE" | "TOO_FRAGMENTED" | "NOTHING_TO_CONSOLIDATE" | "ABORTED" | "INSTANCE_CLOSED" | "PROVER_WORKER" | "PROOF_HANDLE_INVALIDATED" | "PROOF_EXPIRED" | "INVALID_REQUEST" | "INVALID_CONFIG" | "SIGNER_CONTRACT_VIOLATION" | "INTERNAL"
Parameters
err
unknown
code
C
Returns
err is ArmadaErrorByCode[C]