Skip to main content

azoth_scheduler/
error.rs

1//! Error types for the scheduler.
2
3use thiserror::Error;
4
5/// Result type for scheduler operations.
6pub type Result<T> = std::result::Result<T, SchedulerError>;
7
8/// Errors that can occur in the scheduler.
9#[derive(Debug, Error)]
10pub enum SchedulerError {
11    /// Database error.
12    #[error("Database error: {0}")]
13    Database(#[from] rusqlite::Error),
14
15    /// Azoth core error.
16    #[error("Azoth error: {0}")]
17    Azoth(#[from] azoth_core::error::AzothError),
18
19    /// Serialization error.
20    #[error("Serialization error: {0}")]
21    Serialization(#[from] serde_json::Error),
22
23    /// Invalid schedule.
24    #[error("Invalid schedule: {0}")]
25    InvalidSchedule(String),
26
27    /// Task handler not found.
28    #[error("Task handler not found: {0}")]
29    HandlerNotFound(String),
30
31    /// Task handler error.
32    #[error("Task handler error: {0}")]
33    HandlerError(String),
34
35    /// Task execution timeout.
36    #[error("Task execution timeout")]
37    Timeout,
38
39    /// Task not found.
40    #[error("Task not found: {0}")]
41    TaskNotFound(String),
42
43    /// Invalid task configuration.
44    #[error("Invalid task configuration: {0}")]
45    InvalidTask(String),
46
47    /// Cron parsing error.
48    #[error("Cron parsing error: {0}")]
49    CronParse(#[from] cron::error::Error),
50
51    /// Other error.
52    #[error("{0}")]
53    Other(String),
54}