Ceramic.Error exception (Ceramic v0.1.2)

Copy Markdown View Source

Raised or returned for every failure. Match on kind and status:

{:error, %Ceramic.Error{kind: :api_status, status: 401, body: %{"code" => code}}}

kind is :validation (rejected before sending), :api_status (any non-2xx), :invalid_response (2xx whose body is not a JSON object), :timeout, or :connection. body is the decoded JSON error body when the API returned one.

Summary

Types

t()

@type t() :: %Ceramic.Error{
  __exception__: term(),
  body: term(),
  kind: :validation | :api_status | :invalid_response | :timeout | :connection,
  message: String.t(),
  status: pos_integer() | nil
}

Functions

from_exception(exception)

from_response(response)

invalid_response(response)

validation(message)