Unified error types for Candil.
All functions in Candil return {:ok, result} or {:error, Candil.Error.t}
to provide consistent error handling across the library.
Summary
Functions
Creates a context overflow error when messages exceed the model's context window.
Creates an engine exited error with exit code.
Creates an error for an engine that is not running.
Creates an error for an HTTP error with status and optional body.
Creates an invalid API key error.
Creates an invalid request error with a message.
Creates an error for a model that was not found.
Creates a provider not found error.
Creates a rate limiting error.
Creates a startup timeout error.
Creates a timeout error.
Wraps a raw error reason into a Candil.Error.
Types
@type reason() :: :model_not_found | :engine_not_running | :http_error | :timeout | :rate_limited | :invalid_api_key | :context_overflow | :provider_not_found | :invalid_request | :engine_exited | :startup_timeout | term()
Functions
@spec context_overflow(non_neg_integer(), non_neg_integer()) :: t()
Creates a context overflow error when messages exceed the model's context window.
@spec engine_exited(non_neg_integer(), atom()) :: t()
Creates an engine exited error with exit code.
@spec engine_not_running(Candil.Engine.alias() | term()) :: t()
Creates an error for an engine that is not running.
@spec http_error(pos_integer(), term()) :: t()
Creates an error for an HTTP error with status and optional body.
@spec invalid_api_key() :: t()
Creates an invalid API key error.
Creates an invalid request error with a message.
@spec model_not_found(Candil.Model.alias() | term()) :: t()
Creates an error for a model that was not found.
@spec provider_not_found(Candil.Provider.alias() | term()) :: t()
Creates a provider not found error.
Creates a rate limiting error.
Creates a startup timeout error.
Creates a timeout error.
Wraps a raw error reason into a Candil.Error.