use polars::prelude::PolarsError;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum ValidationError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Polars operation failed: {0}")]
Polars(#[from] PolarsError),
#[error("Contract parsing error: {0}")]
ContractParse(String),
#[error("Validation failed: {0}")]
ValidationFailed(String),
#[error("Connector error: {0}")]
Connector(String),
#[error("Profile not found: {0}")]
ProfileNotFound(String),
#[error("Regex pattern error: {0}")]
Regex(#[from] regex::Error),
#[error("Internal Error: {0}")]
Anyhow(#[from] anyhow::Error),
#[error("File size {size} exceeds maximum {max} bytes")]
FileTooLarge { size: usize, max: usize },
#[error("{0}")]
Other(String),
}
pub type ValidationResult<T> = Result<T, ValidationError>;
impl From<Box<dyn std::error::Error>> for ValidationError {
fn from(err: Box<dyn std::error::Error>) -> Self {
ValidationError::Other(err.to_string())
}
}