pub enum GeminiError {
Network(Error),
RequestSerialization(Error),
ResponseParsing {
context: String,
source: Error,
},
ApiError {
status: StatusCode,
detail: Option<GeminiErrorDetail>,
body_text: String,
},
InvalidConfiguration(String),
InvalidInput(String),
UnexpectedResponse(String),
Streaming(String),
BatchTooLarge {
limit: Option<usize>,
actual: usize,
},
}Expand description
Internal error type consolidating all possible failures within the Gemini client.
This type is intended to be converted into the public ChatError or EmbeddingError
at the trait implementation boundaries.
Variants§
Network(Error)
Error during network communication (sending request, reading response).
RequestSerialization(Error)
Error serializing the request body to JSON.
ResponseParsing
Error parsing a successful response body from the API.
ApiError
Error reported by the Gemini API (received non-success status code).
Fields
status: StatusCodeHTTP status code received from the API.
InvalidConfiguration(String)
Invalid configuration provided to the client.
InvalidInput(String)
Invalid input provided to an API method (e.g., empty text list, batch size exceeded). This is for validation before sending the request or based on API feedback clearly indicating bad input (like specific 400 errors).
UnexpectedResponse(String)
The API returned an unexpected response format or data inconsistency. (e.g., embedding count mismatch, missing expected fields in success response).
Streaming(String)
Error specific to streaming operations (placeholder for future implementation).
BatchTooLarge
The number of input chunks exceeds the batch size limit.
Trait Implementations§
Source§impl Debug for GeminiError
impl Debug for GeminiError
Source§impl Display for GeminiError
impl Display for GeminiError
Source§impl Error for GeminiError
impl Error for GeminiError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Error> for GeminiError
impl From<Error> for GeminiError
Source§impl From<GeminiError> for ChatError
impl From<GeminiError> for ChatError
Source§fn from(err: GeminiError) -> Self
fn from(err: GeminiError) -> Self
Source§impl From<GeminiError> for EmbeddingError
impl From<GeminiError> for EmbeddingError
Source§fn from(err: GeminiError) -> Self
fn from(err: GeminiError) -> Self
Auto Trait Implementations§
impl !RefUnwindSafe for GeminiError
impl !UnwindSafe for GeminiError
impl Freeze for GeminiError
impl Send for GeminiError
impl Sync for GeminiError
impl Unpin for GeminiError
impl UnsafeUnpin for GeminiError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more