Gemini.Error (GeminiEx v0.2.1)

View Source

Standardized error structure for Gemini client.

Summary

Types

API-specific error code or reason, if provided by Gemini.

Additional details or context about the error.

A human-readable message describing the error.

The type of error.

The HTTP status code, if the error originated from an HTTP response.

The original error term, if this error is wrapping another.

t()

Functions

Create an API error from Gemini response.

Create a configuration error.

Create an invalid response error.

Create a network/connection error.

Create a new error with type and message.

Create a JSON serialization/deserialization error.

Create a request validation error.

Types

api_reason()

@type api_reason() :: term() | nil

API-specific error code or reason, if provided by Gemini.

error_details()

@type error_details() :: map() | nil

Additional details or context about the error.

error_message()

@type error_message() :: String.t()

A human-readable message describing the error.

error_type()

@type error_type() :: atom()

The type of error.

http_status()

@type http_status() :: integer() | nil

The HTTP status code, if the error originated from an HTTP response.

original_error()

@type original_error() :: term() | nil

The original error term, if this error is wrapping another.

t()

@type t() :: %Gemini.Error{
  api_reason: term() | nil,
  details: map() | nil,
  http_status: integer() | nil,
  message: String.t(),
  original_error: term() | nil,
  type: atom()
}

Functions

api_error(reason, message, details \\ %{})

Create an API error from Gemini response.

config_error(message, details \\ %{})

Create a configuration error.

http_error(status, message, details \\ %{})

Create an HTTP error.

invalid_response(message, details \\ %{})

Create an invalid response error.

network_error(message, original_error \\ nil)

Create a network/connection error.

new(type, message, attrs \\ [])

Create a new error with type and message.

serialization_error(message, details \\ %{})

Create a JSON serialization/deserialization error.

validation_error(message, details \\ %{})

Create a request validation error.