synwire_core/error/
model.rs1use std::time::Duration;
4
5#[derive(Debug, thiserror::Error)]
7#[non_exhaustive]
8pub enum ModelError {
9 #[error("rate limit exceeded{}", .retry_after.map(|d| format!(", retry after {d:?}")).unwrap_or_default())]
11 RateLimit {
12 retry_after: Option<Duration>,
14 },
15 #[error("authentication failed: {message}")]
17 AuthenticationFailed {
18 message: String,
20 },
21 #[error("invalid request: {message}")]
23 InvalidRequest {
24 message: String,
26 },
27 #[error("content filtered: {message}")]
29 ContentFiltered {
30 message: String,
32 },
33 #[error("request timed out")]
35 Timeout,
36 #[error("connection error: {source}")]
38 Connection {
39 source: Box<dyn std::error::Error + Send + Sync>,
41 },
42 #[error("model error: {message}")]
44 Other {
45 message: String,
47 },
48}