lariv-rs 0.1.0

Compile-time plugin web application framework built on Axum, SeaORM, Maud, and HTMX
Documentation
//! Error types for Gemini API calls.

use thiserror::Error;

/// Errors from [`crate::genai::GenaiClient`] HTTP and JSON handling.
#[derive(Debug, Error)]
pub enum GenaiError {
    /// No API key configured (LLM Assistant preferences, or `GOOGLE_API_KEY` / `GEMINI_API_KEY`).
    #[error("Gemini API key is not configured")]
    MissingApiKey,
    /// Underlying reqwest transport failure.
    #[error("HTTP request failed: {0}")]
    Http(#[from] reqwest::Error),
    /// Non-success HTTP status with response body.
    #[error("Gemini API error: status {status}, body: {body}")]
    Api { status: u16, body: String },
    /// Success HTTP status but JSON `error` field in the response envelope.
    #[error("Gemini API returned error: {message}")]
    ApiMessage { message: String },
    /// Response parsed but contained no candidate content.
    #[error("empty model response (no candidates)")]
    EmptyResponse,
    /// Response body was not valid JSON for the expected schema.
    #[error("failed to parse response JSON: {0}")]
    Json(String),
    /// Files API upload finished but processing never became `ACTIVE`.
    #[error("Gemini file processing failed: {0}")]
    FileProcessing(String),
}