use std::{error::Error as StdError, num::TryFromIntError};
use thiserror::Error;
#[cfg(feature = "storage")]
#[cfg_attr(docsrs, doc(cfg(feature = "storage")))]
use crate::storage::StorageError;
pub(crate) type BoxDynError = Box<dyn StdError + 'static + Send + Sync>;
#[derive(Error, Debug)]
#[non_exhaustive]
pub enum JobError {
#[error("Job Failed: {0}")]
Failed(#[source] BoxDynError),
#[cfg(feature = "storage")]
#[cfg_attr(docsrs, doc(cfg(feature = "storage")))]
#[error("Error communicating with storage: {0}")]
Storage(#[from] StorageError),
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("TryFromIntError {0}")]
IntParseError(#[from] TryFromIntError),
#[cfg(feature = "extensions")]
#[error("MissingContext: {0}")]
MissingContext(String),
}
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum JobStreamError {
#[error("Broken Pipe: {0}")]
BrokenPipe(#[source] BoxDynError),
}