use antecedent_data::DataError;
use antecedent_discovery::DiscoveryError;
use antecedent_estimate::EstimationError;
use antecedent_prob::ProbError;
use antecedent_stats::StatsError;
use thiserror::Error;
#[derive(Clone, Debug, Error, Eq, PartialEq)]
pub enum ValidationError {
#[error(transparent)]
Data(#[from] DataError),
#[error(transparent)]
Estimation(#[from] EstimationError),
#[error(transparent)]
Stats(#[from] StatsError),
#[error(transparent)]
Prob(#[from] ProbError),
#[error(transparent)]
Discovery(#[from] DiscoveryError),
#[error("{message}")]
NotApplicable {
message: &'static str,
},
}
impl ValidationError {
#[must_use]
pub fn data_msg(message: impl Into<String>) -> Self {
Self::Data(DataError::InvalidArgument { message: message.into() })
}
#[must_use]
pub fn estimation_msg(message: impl Into<String>) -> Self {
Self::Estimation(EstimationError::stats_msg(message))
}
}