taskforceai_sdk/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum TaskForceAIError {
5    #[error("API key is required when not in mock mode")]
6    MissingApiKey,
7    #[error("Prompt must be a non-empty string")]
8    EmptyPrompt,
9    #[error("Task ID must be a non-empty string")]
10    EmptyTaskId,
11    #[error("Network error: {0}")]
12    Network(#[from] reqwest::Error),
13    #[error("Serialization error: {0}")]
14    Serialization(#[from] serde_json::Error),
15    #[error("Task failed: {0}")]
16    TaskFailed(String),
17    #[error("Task did not complete within the expected time")]
18    Timeout,
19    #[error("API error (status {status}): {message}")]
20    Api {
21        status: reqwest::StatusCode,
22        message: String,
23    },
24    #[error("Stream error: {0}")]
25    Stream(String),
26    #[error("Other error: {0}")]
27    Other(String),
28}