mistralai_client/v1/
error.rs1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct ApiError {
6 pub message: String,
7}
8impl fmt::Display for ApiError {
9 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10 write!(f, "ApiError: {}", self.message)
11 }
12}
13impl Error for ApiError {}
14
15#[derive(Debug, PartialEq, thiserror::Error)]
16pub enum ClientError {
17 #[error(
18 "You must either set the `MISTRAL_API_KEY` environment variable or specify it in `Client::new(api_key, ...)."
19 )]
20 MissingApiKey,
21 #[error("Failed to read the response text.")]
22 UnreadableResponseText,
23}