Files
mistralai-client-rs/src/v1/error.rs
Ivan Gabriele 33876183e4 feat!: wrap Client::new() return in a Result
BREAKING CHANGE: `Client::new()` now returns a `Result`.
2024-03-04 04:43:22 +01:00

20 lines
492 B
Rust

use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub struct ApiError {
pub message: String,
}
impl fmt::Display for ApiError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ApiError: {}", self.message)
}
}
impl Error for ApiError {}
#[derive(Debug, PartialEq, thiserror::Error)]
pub enum ClientError {
#[error("You must either set the `MISTRAL_API_KEY` environment variable or specify it in `Client::new(api_key, ...).")]
ApiKeyError,
}