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
//! [`QueueError`].
use navree_db::DbError;
use navree_orm::OrmError;
/// What can go wrong when queueing or working jobs.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum QueueError {
/// No module registered a handler for the job type (`m.job::<J>()`).
#[error(
"no handler is registered for job type `{job_type}`; register it with `m.job::<J>()` (ModuleBuilderJobsExt)"
)]
UnknownJob {
/// The job type ([`Job::NAME`](navree_contracts::Job::NAME)).
job_type: String,
},
/// `retry` was given the id of a failed job that does not exist.
#[error("there is no failed job with id `{id}`")]
FailedJobNotFound {
/// The id given.
id: String,
},
/// The job could not be serialized, or a stored job could not be read back.
#[error("invalid job payload: {0}")]
Payload(#[source] serde_json::Error),
/// A database error (database driver).
#[error(transparent)]
Db(#[from] DbError),
/// A failed-jobs ORM operation failed (database driver).
#[error(transparent)]
Orm(#[from] OrmError),
/// A driver from another crate failed (a [`QueueStore`](crate::QueueStore)
/// such as navree-redis's): connection, protocol, ...
#[error("the queue driver failed: {0}")]
Store(navree_contracts::BoxError),
/// The app owning the queue has been dropped.
#[error("the app owning this queue has shut down")]
ShutDown,
/// Operations are stored in the app database, and the app has no
/// `DatabaseModule`.
#[error("operations need the app database: add DatabaseModule to the app")]
NoDatabase,
}