1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use apalis_core::task::{status::StatusError, task_id::TaskIdError};
use sqlx::Error as SqlxError;
/// Represents a wrapper for errors encountered on this crate
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Inner engine error
#[error(transparent)]
Database(#[from] SqlxError),
/// Error handling json
#[error("JsonError: {0}")]
JsonError(serde_json::Error),
/// Reenqueue Mismatch error
#[error("ReenqueueMismatch: Queued [{queued}] , Abandoned[{abandoned}] ")]
ReenqueueMismatch {
/// The db count
queued: usize,
/// The workers count
abandoned: usize,
},
/// Error decoding the task_id
#[error("TaskId Error: {0}")]
TaskIdError(TaskIdError),
/// Error decoding the task status
#[error("StatusError: {0}")]
StatusError(StatusError),
/// Worker was removed in the database
#[error("WorkerOutOfSync")]
WorkerOutOfSync,
/// Tried to register a worker that already exists
#[error("WorkerAlreadyExists: {0}")]
WorkerAlreadyExists(String),
#[error(
"UpgradeRequired: Current version {current}, Required version {required}. \n Link: {link:?}"
)]
UpgradeRequired {
/// The current version of the migrations in the database
current: String,
/// The required version of the migrations in the database
required: String,
/// Optional link to the migration guide
link: Option<String>,
},
}