google_generative_ai_rs/v1/
errors.rs

1use reqwest::StatusCode;
2use std::error::Error;
3use std::fmt;
4
5#[derive(Debug)]
6pub struct GoogleAPIError {
7    pub message: String,
8    pub code: Option<StatusCode>,
9}
10impl fmt::Display for GoogleAPIError {
11    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
12        write!(
13            f,
14            "GoogleAPIError - code: {:?} error: {}",
15            self.code, self.message
16        )
17    }
18}
19impl Error for GoogleAPIError {}