Ollixir.ResponseError exception (Ollixir v0.1.1)

Copy Markdown View Source

Exception raised for API response errors.

This error is raised when the Ollama API returns an error response. It includes both the HTTP status code and the API error message.

Summary

Functions

Check if error is a client error (4xx).

Create from HTTP response.

Check if error indicates model not found.

Check if error is retryable.

Check if error is a server error (5xx).

Check if error indicates unauthorized.

Types

t()

@type t() :: %Ollixir.ResponseError{
  __exception__: true,
  body: map() | String.t() | nil,
  error: String.t() | nil,
  message: String.t(),
  status: integer()
}

Functions

client_error?(response_error)

@spec client_error?(t()) :: boolean()

Check if error is a client error (4xx).

from_response(map)

@spec from_response(Req.Response.t() | map()) :: t()

Create from HTTP response.

not_found?(arg1)

@spec not_found?(t()) :: boolean()

Check if error indicates model not found.

retryable?(arg1)

@spec retryable?(t()) :: boolean()

Check if error is retryable.

server_error?(response_error)

@spec server_error?(t()) :: boolean()

Check if error is a server error (5xx).

unauthorized?(arg1)

@spec unauthorized?(t()) :: boolean()

Check if error indicates unauthorized.