Structured error types for the Conduit SDK.
All transports and client operations return {:error, %DatagroutConduit.Error{}} for
typed error conditions (rate limit, auth). Other errors may still be {:error, term}.
Example
case DatagroutConduit.Client.list_tools(client) do
{:ok, tools} -> tools
{:error, %DatagroutConduit.Error{type: :rate_limit, retry_after: t}} ->
Process.sleep(:timer.seconds(String.to_integer(t || "5")))
{:error, %DatagroutConduit.Error{type: :auth, message: msg}} ->
raise "Auth failure: #{msg}"
{:error, reason} ->
raise "Unexpected error: #{inspect(reason)}"
end
Summary
Functions
Returns an authentication error (HTTP 401 or token rejection).
Returns a configuration error raised during client setup.
Returns a network-layer error (connection refused, DNS failure, etc.).
Returns an error indicating the client has not been initialized.
Returns a rate-limit error with an optional Retry-After value from the server.
Returns a server-side error with an HTTP status code.
Types
@type error_type() ::
:not_initialized
| :rate_limit
| :auth
| :network
| :protocol
| :timeout
| :invalid_config
| :server
| :other
@type t() :: %DatagroutConduit.Error{ __exception__: true, code: integer() | nil, message: String.t(), retry_after: String.t() | nil, type: error_type() }
Functions
Returns an authentication error (HTTP 401 or token rejection).
Returns a configuration error raised during client setup.
Returns a network-layer error (connection refused, DNS failure, etc.).
Returns an error indicating the client has not been initialized.
Used when a call is attempted before start_link/1 succeeds.
Returns a rate-limit error with an optional Retry-After value from the server.
The retry_after value, when present, is the raw string value of the
Retry-After HTTP response header (e.g. "30" for 30 seconds).
Returns a server-side error with an HTTP status code.