2023-03-04 18:07:17 +00:00
|
|
|
use thiserror::Error;
|
|
|
|
|
2023-03-07 15:41:20 +00:00
|
|
|
/// Library errors
|
2023-03-09 15:59:45 +00:00
|
|
|
#[derive(Debug, Error)]
|
|
|
|
pub enum BackieError {
|
2023-03-11 15:38:32 +00:00
|
|
|
#[error("Queue \"{0}\" needs to be configured because of registered tasks: {1:?}")]
|
|
|
|
QueueNotConfigured(String, Vec<String>),
|
|
|
|
|
|
|
|
#[error("Provided task is not serializable to JSON: {0}")]
|
|
|
|
NonSerializableTask(#[from] serde_json::Error),
|
|
|
|
|
2023-03-10 22:41:34 +00:00
|
|
|
#[error("Queue processing error: {0}")]
|
2023-03-09 15:59:45 +00:00
|
|
|
QueueProcessingError(#[from] AsyncQueueError),
|
2023-03-04 18:07:17 +00:00
|
|
|
|
2023-03-10 22:41:34 +00:00
|
|
|
#[error("Worker Pool shutdown error: {0}")]
|
|
|
|
WorkerPoolShutdownError(#[from] tokio::sync::watch::error::SendError<()>),
|
|
|
|
|
|
|
|
#[error("Worker shutdown error: {0}")]
|
|
|
|
WorkerShutdownError(#[from] tokio::sync::watch::error::RecvError),
|
2023-03-04 19:46:09 +00:00
|
|
|
}
|
|
|
|
|
2023-03-04 18:07:17 +00:00
|
|
|
#[derive(Debug, Error)]
|
|
|
|
pub enum AsyncQueueError {
|
|
|
|
#[error(transparent)]
|
|
|
|
PgError(#[from] diesel::result::Error),
|
2023-03-07 15:41:20 +00:00
|
|
|
|
2023-03-10 22:41:34 +00:00
|
|
|
#[error("Task with name {0} is not registered")]
|
|
|
|
TaskNotRegistered(String),
|
2023-03-04 18:07:17 +00:00
|
|
|
}
|