Skip to content

Handle errors

@beblurt/dblurt preserves historical error names and messages for compatibility while adding structured classification metadata for applications that need safer retry and display decisions.

Use this guide when deciding whether to retry, fail over, surface validation feedback or stop a workflow.

Classify first

ts
import { classifyError, isDBlurtError } from '@beblurt/dblurt';

try {
    await client.condenser.getAccounts(['beblurt']);
} catch (error) {
    const metadata = classifyError(error);

    if (metadata.retryable) {
        // retry or fail over according to your policy
    }

    if (isDBlurtError(error)) {
        console.error(metadata.category, metadata.code);
    }
}

Avoid string-matching arbitrary error messages when stable classification metadata is available.

Error categories

CategoryTypical meaningCommon action
validationSDK input rejected before RPC/broadcastask caller/user to fix input
timeoutrequest exceeded configured timeoutretry/fail over if workflow is a blockchain query
transportnetwork or HTTP-level failureretry/fail over if safe
rpc_applicationRPC node returned an application errorinspect code/data; retry only when justified
serializationsigning/serialization failedfix payload/key handling
unknownnot recognizedfail safely and log non-sensitive context

Exact metadata fields belong to the API reference.

Query retries vs broadcast retries

Blockchain queries can often be retried with bounded backoff because they do not submit transactions.

Broadcast operations are different. A timeout after submission may be ambiguous. The transaction may have been accepted, rejected, still propagating or never received.

WorkflowRetry posture
blockchain queryretry/fail over when retryable and bounded
blockchain parsingretry from last checkpoint when safe
operation builderfix validation input; retry is usually not useful
broadcast operationdo not blindly retry; reconcile transaction context first

Validation errors

Validation errors are useful for user correction:

ts
import { ValidationError } from '@beblurt/dblurt';

if (error instanceof ValidationError) {
    console.error(error.field, error.path);
}

Do not include private keys, signed payloads with sensitive context or secret environment values in logs.

RPC errors

RPC application errors come from a Blurt RPC endpoint. Preserve the distinction between:

  • a method or payload rejected by the node;
  • a transport problem reaching the node;
  • a timeout waiting for the response;
  • a mismatched or malformed JSON-RPC response.

This distinction matters for retry policy and user-facing messages.

Validated example

API details