Docs SDK
SDK errors
Every SDK failure is one AcruxError with a stable code, whether the gateway refused the call or the SDK refused the input.
Every failure the SDK raises is an AcruxError, the contract's ApiClientError. A refusal from the gateway and a refusal of the input by the SDK itself have the same shape.
errors.ts
import { AcruxError } from '@acrux/sdk'
try {
await acrux.send(tx, { n: 3, t: 2, signer: payer })
} catch (error) {
if (error instanceof AcruxError && error.code === 'TRANSACTION_EXPIRED') {
// the target slot started before the gateway admitted the send: sign over a fresh blockhash and send again
}
}| Member | Type | Meaning |
|---|---|---|
code | ErrorCode | the stable code to branch on |
status | integer | the HTTP status the code carries |
message | string | a sentence that can be shown as it is |
body.error | ApiError | the whole envelope: code, message, retryable, stage, and fieldErrors for invalid params |
Raised by the SDK
| Code | When |
|---|---|
INVALID_INPUT | n or t outside 1 to 3, or t greater than n |
INVALID_INPUT | t of 2 or 3 without a signer |
INVALID_INPUT | signer is not the transaction's fee payer |
INVALID_INPUT | the bytes are not a signed Solana transaction |
INVALID_INPUT | open was given fewer than t distinct fragments, or fragments that do not decrypt |
NET_UNAVAILABLE | the event stream closed while tx.follow was reading it |
Raised by the gateway on a send
| Code | Cause | What to do |
|---|---|---|
INVALID_INPUT | a field failed validation, or the target slot is more than 64 slots ahead | fix the input |
TRANSACTION_EXPIRED | the target slot had started when the gateway admitted the send | sign over a fresh blockhash and send again |
CHAIN_REFUSED | the node refused the transaction or fragment | fix the transaction; message says why |
IDEMPOTENCY_CONFLICT | the ID was sent before with a different header, n or t, or this fragment index with a different fragment | send a new transaction |
NET_UNAVAILABLE | the gateway cannot reach the net | retry; retryable is true |
The JSON-RPC error codes behind these are on JSON-RPC; every code is in ErrorCode.
Retrying
body.error.retryable says whether the same call can succeed later. A send refused with TRANSACTION_EXPIRED is not retried as it is: its target slot has passed, so send the transaction again, signed over the blockhash from latestBlockhash().