@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / IndexerError

Class: IndexerError

Defined in: packages/sdk/src/errors.ts:186

An indexer (Hasura/Envio GraphQL) request did not complete.

When to use

Use when opting into graceful degradation — this is the error to catch to serve stale or empty UI instead of failing a page. It is safe to treat as transient-or-misconfigured: endpoint down, bad URL, schema drift, timeout.

Gotchas

This ALWAYS means "the read didn't happen" — never "there is no such row". A point read that finds nothing resolves to null and a list read to []; both are successful reads. Treating this as "not found" will hide an outage behind an empty state.

Example (Falling back after an indexer failure)

ts
import { IndexerError } from "@somnia-chain/markets-sdk";

const markets = await exchange.client
  .listBinaryMarkets()
  .catch((e) => { if (e instanceof IndexerError) return []; throw e; });

Extends

Constructors

Constructor

new IndexerError(operation, detail, options?): IndexerError

Defined in: packages/sdk/src/errors.ts:196

Creates an indexer error with operation context and an optional cause.

Details

  • operation: GraphQL operation name that failed (e.g. "listBinaryMarkets").
  • detail: Why it failed (HTTP status, GraphQL error message, "empty response").
  • options: Standard cause passthrough — the underlying fetch/GraphQL failure.

Parameters

operation

string

detail

string

options?

ErrorOptions

Returns

IndexerError

Overrides

SomniaMarketsError.constructor

Properties

operation

readonly operation: string

Defined in: packages/sdk/src/errors.ts:197