Polymarket.Schemas.ClobError (Polymarket v0.1.1)

Copy Markdown View Source

A non-200 error from a CLOB request, pairing the HTTP status with the server's message.

Order rejections surface here — e.g. an unfunded wallet yields a 400 whose error describes the missing balance or allowance. code and retry_after_seconds are populated when the server provides them (e.g. post-only mode), otherwise nil.

Summary

Functions

Builds a ClobError from an HTTP status and the (JSON-decoded) error body.

Types

t()

@type t() :: %Polymarket.Schemas.ClobError{
  code: String.t() | nil,
  error: String.t(),
  retry_after_seconds: non_neg_integer() | nil,
  status: non_neg_integer()
}

Functions

from_response(status, body)

@spec from_response(non_neg_integer(), term()) :: t()

Builds a ClobError from an HTTP status and the (JSON-decoded) error body.

A map body is read for the error/code/retry_after_seconds fields; any other body is stringified into error so nothing is lost.