use crate::prelude::*;
#[derive(Error, Debug)]
pub enum TaskError {
#[error("Cron expression analysis error.")]
FrequencyAnalyzeError(#[from] FrequencyAnalyzeError),
#[error("Task sending failure.")]
DisSend(#[from] channel::TrySendError<TimerEvent>),
#[error("Task event get failed.")]
DisGetEvent(#[from] channel::TryRecvError),
}
#[derive(Error, Debug)]
pub enum TaskInstanceError {
#[error("TaskInstance sending failure.")]
DisSend(#[from] channel::TrySendError<TimerEvent>),
#[error("TaskInstance event get failed.")]
DisGetEvent(#[from] channel::TryRecvError),
#[error("The task has been (completed or canceled) and cannot be cancelled.")]
DisCancel,
#[error("Waiting for cancellation timeout.")]
DisCancelTimeOut,
#[error("Missing `timer_event_sender`.")]
MisEventSender,
#[error("Task instance channel exception.")]
InternalChannelAnomaly(#[from] channel::RecvError),
#[error("Running instance of the task is no longer maintained.")]
Expired,
}
#[derive(Error, Debug)]
pub enum FrequencyAnalyzeError {
#[error("Thread local storage access failed.")]
DisAccess(#[from] std::thread::AccessError),
#[error("The cron expression was parsed incorrectly.")]
DisParse(#[from] cron_error::Error),
#[error("The initialization time is wrong.")]
DisInitTime,
}
#[derive(Error, Debug)]
pub enum CommandChildError {
#[error("Process execution conditions are not met for {0}")]
DisCondition(String),
}