Represents an error returned by the Pluggy API or a transport-level failure.
Fields
:code- HTTP status code (integer) or:transportfor connection errors:message- Human-readable error message:code_description- Optional machine-readable error code from the API:data- Optional additional error data from the API
Summary
Functions
Builds an error from an API response body (already snake_cased by the pipeline).
Builds an error for transport-level failures (timeout, connection refused, etc.).
Types
Functions
Builds an error from an API response body (already snake_cased by the pipeline).
Examples
iex> Pluggy.Error.from_response(%{code: 401, message: "Unauthorized"})
%Pluggy.Error{code: 401, message: "Unauthorized"}
iex> Pluggy.Error.from_response(%{code: 400, message: "Bad Request", code_description: "VALIDATION_ERROR", data: %{field: "amount"}})
%Pluggy.Error{code: 400, message: "Bad Request", code_description: "VALIDATION_ERROR", data: %{field: "amount"}}
Builds an error for transport-level failures (timeout, connection refused, etc.).
Examples
iex> Pluggy.Error.transport(:timeout)
%Pluggy.Error{code: :transport, message: "timeout"}