Skip to main content
The SDK exposes two error classes:
  • OstiumError for client creation, transaction building, signing, submission, and contract interaction
  • OstiumSubgraphError for subgraph reads, builder API reads, parsing, and stream-related data lookups

OstiumError

OstiumError is thrown by the main OstiumClient surface.

Error codes

OstiumSubmissionPendingError

OstiumSubmissionPendingError extends OstiumError with code SUBMISSION_PENDING. It is thrown when an operation reached the network but the SDK could not confirm how it ended — in practice, when waiting for a gasless UserOperation receipt times out after 120 seconds. This is not a failure: the operation was accepted and can still land, so retrying risks opening the position twice. Reconcile instead of resubmitting:
A gasless trade that reverts on-chain raises OstiumError with code CONTRACT_ERROR, naming the contract error — it is never reported as a success.

OstiumSubgraphError

OstiumSubgraphError is thrown by read methods backed by the subgraph or builder API.

Error codes

  • Catch OstiumError around trade setup and write methods.
  • Catch OstiumSubgraphError around read methods and streams.
  • Log both error.code and error.message.
  • If present, inspect error.cause for the underlying RPC, contract, or fetch error.