PolymarketClob.Error (PolymarketClob v0.2.0)

Copy Markdown View Source

Normalized error returned by Polymarket CLOB API helpers.

Every PolymarketClob.API.* and PolymarketClob.HTTP.* call returns either {:ok, body} or {:error, %PolymarketClob.Error{}}. Match on :reason to distinguish failure modes without parsing the message string:

  • :http_error — CLOB returned a non-2xx status. :status and :body are populated; :message is the upstream error message when present.
  • :transport_error — Req-level transport failure (DNS, TCP, TLS, timeout). :body carries the underlying exception/reason.
  • :decode_error — response body was not valid JSON when JSON was expected.
  • :auth_error — request would have been authenticated but the PolymarketClob.Client lacks complete L2 credentials (api_key, api_secret, api_passphrase). Raised before any HTTP call is made.

:request_path is populated whenever it is known (which is for every error produced by PolymarketClob.HTTP), and is the path that was attempted — including any query string the caller sent.

Summary

Types

reason()

@type reason() :: :http_error | :transport_error | :decode_error | :auth_error

t()

@type t() :: %PolymarketClob.Error{
  body: term(),
  message: String.t(),
  reason: reason(),
  request_path: String.t() | nil,
  status: non_neg_integer() | nil
}