use crate::ApiError;
use crate::ClientError;
#[derive(Debug, thiserror::Error)]
pub enum ChatApiError {
#[error("Client error: {0:?}")]
ClientError(#[from] ClientError),
#[error("API error: {0:?}")]
ApiError(#[from] ApiError),
#[error("Stream option mismatch")]
StreamOptionMismatch,
}
#[derive(Debug, thiserror::Error)]
pub enum ChatChunkError {
#[error("Stream error: {0:?}")]
StreamError(#[from] reqwest::Error),
#[error("Failed to decode chunk of stream to UTF-8 string: {0:?}")]
StringDecodingError(#[from] std::string::FromUtf8Error),
#[error("Data prefix missing: {0}")]
DataPrefixMissing(String),
#[error("Failed to deserialize chunk: {0:?} from: {1}")]
DeserializeFailed(serde_json::Error, String),
}