Structured error types returned by the Unit API client.
All API functions return {:ok, result} or {:error, Unit.Error.t()}.
Error types
:api_error— The Unit API returned a 4xx/5xx error.:network_error— HTTP transport failure (timeout, connection refused, etc.):decode_error— Response body could not be parsed as JSON:API.:auth_error— 401 Unauthorized.:rate_limit— 429 Too Many Requests.:not_found— 404 Not Found.:conflict— 409 Conflict.:validation_error— 422 Unprocessable Entity.
Summary
Functions
Build a response-decode error.
Build an error from an HTTP response status code and body.
Build a network transport error.
Types
@type classification() ::
:api_error
| :auth_error
| :conflict
| :not_found
| :rate_limit
| :validation_error
@type error_type() ::
:api_error
| :network_error
| :decode_error
| :auth_error
| :rate_limit
| :not_found
| :conflict
| :validation_error
@type t() :: %Unit.Error{ __exception__: true, errors: [api_error_detail()], message: String.t() | nil, raw: term(), status: non_neg_integer() | nil, type: error_type() }