use crate::families::block_layout::block_count::BlockCountMismatch;
#[derive(Clone, Debug)]
pub enum SmoothError {
InvalidConfig { reason: String },
DimensionMismatch { reason: String },
InvalidIndex { reason: String },
}
crate::impl_reason_error_boilerplate! {
SmoothError {
InvalidConfig,
DimensionMismatch,
InvalidIndex,
}
}
impl From<BlockCountMismatch> for SmoothError {
fn from(err: BlockCountMismatch) -> SmoothError {
SmoothError::invalid_index(err.message())
}
}
impl SmoothError {
#[inline]
pub(super) fn invalid_config(reason: impl Into<String>) -> Self {
SmoothError::InvalidConfig {
reason: reason.into(),
}
}
#[inline]
pub(super) fn dimension_mismatch(reason: impl Into<String>) -> Self {
SmoothError::DimensionMismatch {
reason: reason.into(),
}
}
#[inline]
pub(super) fn invalid_index(reason: impl Into<String>) -> Self {
SmoothError::InvalidIndex {
reason: reason.into(),
}
}
}