Skip to main content

apalis_redis/
error.rs

1use apalis_core::task::{status::StatusError, task_id::TaskIdError};
2/// Represents a wrapper for errors encountered on this crate
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    /// Inner engine error
6    #[error(transparent)]
7    Database(#[from] redis::RedisError),
8    /// Error handling json
9    #[error("JsonError: {0}")]
10    Json(serde_json::Error),
11    /// Reenqueue Mismatch error
12    #[error("ReenqueueMismatch: Queued [{queued}] , Abandoned[{abandoned}] ")]
13    ReenqueueMismatch {
14        /// The db count
15        queued: usize,
16        /// The workers count
17        abandoned: usize,
18    },
19    /// Error decoding the task_id
20    #[error("TaskIdError: {0}")]
21    TaskIdError(TaskIdError),
22    /// Error decoding the task status
23    #[error("StatusError: {0}")]
24    StatusError(StatusError),
25    /// Worker was removed in the database
26    #[error("WorkerOutOfSync")]
27    WorkerOutOfSync,
28
29    /// Tried to register a worker that already exists
30    #[error("WorkerAlreadyExists: {0}")]
31    WorkerAlreadyExists(String),
32}