Skip to content
LogoLogo

Errors

ClassThrown whenFields
ArrektaErrorthe node or gateway returns an error (RFC 9457 application/problem+json)status, code, title, detail
DecodeErrorbytes don't decode (bad transaction, PST, address, …)message
ValidationErrora local check fails before anything is sentcode

Branch on code, never on the message: codes are stable and each has a page in the error code reference.

import { ArrektaError, sendTransaction } from 'arrekta-sdk'
 
try {
  await sendTransaction(client, { tx })
} catch (e) {
  if (e instanceof ArrektaError && e.code === 'insufficient-fee') {
    // a conflicting transaction pays more: bump the fee
  } else throw e
}
HTTP statusMeaning
400bad encoding or address
404not found
409rejected by mempool policy
422consensus rule violated
429rate limited

See the error model.