@somnia-chain/markets-sdk / index / IndexerError
Class: IndexerError
Defined in: packages/sdk/src/errors.ts:242
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)
import { IndexerError } from "@somnia-chain/markets-sdk";
const markets = await exchange.client
.listBinaryMarkets()
.catch((e) => { if (e instanceof IndexerError) return []; throw e; });
Extends
Extended by
Constructors
Constructor
new IndexerError(
operation,detail,options?):IndexerError
Defined in: packages/sdk/src/errors.ts:264
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: Standardcausepassthrough — the underlying fetch/GraphQL failure — pluschainIdwhen the failing chain is known.
Parameters
operation
string
detail
string
options?
ErrorOptions & object
Returns
IndexerError
Overrides
SomniaMarketsError.constructor
Properties
chainId?
readonlyoptionalchainId?:number
Defined in: packages/sdk/src/errors.ts:253
The chain whose read failed. Set only on an exchange with two or more
chains, in two cases. The account reads of SomniaMarkets
(fetchBalance, fetchOpenOrders, fetchOrders, getOrdersPage,
getOrderHistoryPage, fetchMyTrades, fetchPositions,
fetchOpenStopOrders, watchUser) set it when the read spans more than
one chain, or when the read has no market and no chain filter, also if it
then touches only one chain. fetchDataStatus sets it on the error it
throws when every chain fails. Absent on every other indexer error.
operation
readonlyoperation:string
Defined in: packages/sdk/src/errors.ts:265