ConvergerClient.Error exception (converger_client v0.1.0)

Copy Markdown View Source

A non-2xx HTTP response, normalized whatever error shape the server used: the standard envelope {"error": {"code", "message", "details", "request_id"}} (#45) or one of the legacy shapes (packages/conformance/errors.json).

Summary

Functions

Builds the error from a status, headers ([{name, value}] or a map) and the raw body.

Types

t()

@type t() :: %ConvergerClient.Error{
  __exception__: true,
  body: term(),
  code: String.t(),
  details: term(),
  message: String.t(),
  request_id: String.t() | nil,
  retry_after: non_neg_integer() | nil,
  status: integer()
}

Functions

from_response(status, headers, raw)

@spec from_response(integer(), Enumerable.t(), binary()) :: t()

Builds the error from a status, headers ([{name, value}] or a map) and the raw body.