use thiserror::Error;
#[derive(Debug, Error)]
pub enum BatchError {
#[error("Invalid configuration: {0}")]
InvalidConfig(String),
#[error("Insufficient system resources: {0}")]
ResourceExhausted(String),
#[error("Cryptographic operation failed: {0}")]
CryptoError(String),
#[error("Parallel processing error: {0}")]
ParallelError(String),
#[error("Key generation failed: {0}")]
GenerationError(String),
#[error("Scanner operation failed: {0}")]
ScannerError(String),
#[error("Stream operation failed: {0}")]
StreamError(String),
#[error("I/O error: {0}")]
IoError(String),
}
impl BatchError {
pub fn invalid_config(msg: impl Into<String>) -> Self {
Self::InvalidConfig(msg.into())
}
pub fn resource_exhausted(msg: impl Into<String>) -> Self {
Self::ResourceExhausted(msg.into())
}
pub fn crypto_error(msg: impl Into<String>) -> Self {
Self::CryptoError(msg.into())
}
pub fn parallel_error(msg: impl Into<String>) -> Self {
Self::ParallelError(msg.into())
}
pub fn generation_error(msg: impl Into<String>) -> Self {
Self::GenerationError(msg.into())
}
pub fn scanner_error(msg: impl Into<String>) -> Self {
Self::ScannerError(msg.into())
}
pub fn stream_error(msg: impl Into<String>) -> Self {
Self::StreamError(msg.into())
}
pub fn io_error(msg: impl Into<String>) -> Self {
Self::IoError(msg.into())
}
}