1use std::time::SystemTimeError;
2
3#[derive(Debug)]
4pub enum GigaChatError {
5 SystemError(String),
6 StreamError(String),
7 HttpError(String),
8 JSONDeserializationError(String),
9 InvalidArgument(String),
10}
11
12impl From<SystemTimeError> for GigaChatError {
13 fn from(error: SystemTimeError) -> Self {
14 GigaChatError::SystemError(error.to_string())
15 }
16}
17
18impl From<reqwest::Error> for GigaChatError {
19 fn from(error: reqwest::Error) -> Self {
20 GigaChatError::HttpError(error.to_string())
21 }
22}
23
24impl From<serde_json::Error> for GigaChatError {
25 fn from(error: serde_json::Error) -> Self {
26 GigaChatError::JSONDeserializationError(error.to_string())
27 }
28}
29
30impl From<std::io::Error> for GigaChatError {
31 fn from(error: std::io::Error) -> Self {
32 GigaChatError::SystemError(error.to_string())
33 }
34}