Structured error type returned by all Solaris API calls.
All public API functions return either {:ok, result} or
{:error, %Solaris.Error{}}, never raw exceptions.
Fields
| Field | Type | Description |
|---|---|---|
:code | code/0 | Normalized atom error code |
:message | String.t() | Human-readable description |
:status | `integer() | nil` | HTTP status code |
:details | `[map()] | nil` | Raw error objects from Solaris API |
:request_id | `String.t() | nil` | X-Request-Id from the failed request |
:change_request_id | `String.t() | nil` | Present when SCA/2FA is required |
Error Codes
| Code | HTTP | Description |
|---|---|---|
:unauthorized | 401 | Invalid or missing credentials |
:forbidden | 403 | Insufficient permissions |
:not_found | 404 | Resource does not exist |
:conflict | 409 | State conflict (e.g. duplicate) |
:unprocessable_entity | 422 | Validation failure |
:rate_limited | 429 | Too many requests |
:internal_server_error | 500 | Solaris server error |
:bad_gateway | 502 | Upstream error |
:service_unavailable | 503 | Service temporarily down |
:timeout | — | HTTP timeout |
:network_error | — | TCP/DNS-level failure |
:invalid_params | — | Invalid arguments to SDK function |
:validation_error | — | Local validation failure |
:unknown | — | Unmapped HTTP status |
Summary
Functions
Builds a Solaris.Error from a caught Req/Mint exception.
Builds a Solaris.Error from a Req.Response map.
Builds an :invalid_params error with a custom message.
Builds a :validation_error with a custom message and optional detail list.
Types
@type code() ::
:unauthorized
| :forbidden
| :not_found
| :conflict
| :unprocessable_entity
| :rate_limited
| :internal_server_error
| :service_unavailable
| :bad_gateway
| :timeout
| :network_error
| :invalid_params
| :validation_error
| :unknown
Functions
@spec from_exception(Exception.t() | map()) :: t()
Builds a Solaris.Error from a caught Req/Mint exception.
@spec from_response(%{ :status => integer(), :body => term(), :headers => term(), optional(atom()) => term() }) :: t()
Builds a Solaris.Error from a Req.Response map.
Extracts the error code, message, details, request ID, and change_request_id from the response status and body.
Builds an :invalid_params error with a custom message.
Builds a :validation_error with a custom message and optional detail list.