Claudio.APIError exception (Claudio v0.5.0)

View Source

Exception raised when the Anthropic API returns an error response.

Summary

Functions

Creates a new APIError from an HTTP error response.

Types

error_type()

@type error_type() ::
  :invalid_request_error
  | :authentication_error
  | :permission_error
  | :not_found_error
  | :rate_limit_error
  | :api_error
  | :overloaded_error

t()

@type t() :: %Claudio.APIError{
  __exception__: true,
  message: String.t(),
  raw_body: map() | nil,
  status_code: integer(),
  type: error_type() | String.t()
}

Functions

from_response(status_code, body)

@spec from_response(integer(), map() | struct()) :: t()

Creates a new APIError from an HTTP error response.

Handles both plain maps (non-streaming responses) and structs like Req.Response.Async (streaming error responses).