Structured error returned by Gaiia.Client calls.
The :kind discriminates the failure mode so callers can pattern match
rather than parse messages:
:graphql— the server returned a 200 with one or more entries inerrors:http— the server returned a non-2xx HTTP response:network— the request never reached the server (connection refused, DNS, etc.):decode— the response was 2xx but the body was not a valid GraphQL envelope
Most Gaiia failures are :graphql at HTTP 200 — authentication, validation,
and rate limiting all arrive that way. :code carries the first error's
extensions.code (e.g. "UNAUTHENTICATED", "RATE_LIMITED") so callers
can branch without digging through :errors, and :rate_limit carries the
budget the API reported.
Expected mutation failures are not errors: they come back inside the
mutation payload as %{"errors" => [%{"code" => ..., "message" => ...}]}
in an {:ok, data} result, and callers must inspect them there.
Summary
Functions
Build a :decode error from an undecodable response body.
Build a :graphql error from a list of GraphQL error maps.
Build an :http error from a status code and response body.
Build a :network error from a transport-layer exception.
Types
@type kind() :: :graphql | :http | :network | :decode
@type t() :: %Gaiia.Error{ __exception__: term(), code: String.t() | nil, details: term(), errors: [map()] | nil, kind: kind(), message: String.t(), rate_limit: Gaiia.RateLimit.t() | nil, status: pos_integer() | nil }
Functions
Build a :decode error from an undecodable response body.
Build a :graphql error from a list of GraphQL error maps.
Options: :status and :rate_limit, both taken from the HTTP response.
@spec http(pos_integer(), term(), keyword()) :: t()
Build an :http error from a status code and response body.
Options: :rate_limit, taken from the HTTP response.
@spec network(Exception.t() | term()) :: t()
Build a :network error from a transport-layer exception.