use std::fmt;
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum BlockCodegenError {
TopSelection(String),
InvalidBlock(String),
Unsupported(String),
NotPipeline(String),
Emission(String),
}
impl fmt::Display for BlockCodegenError {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::TopSelection(message)
| Self::InvalidBlock(message)
| Self::Unsupported(message)
| Self::NotPipeline(message)
| Self::Emission(message) => formatter.write_str(message),
}
}
}
impl std::error::Error for BlockCodegenError {}
impl From<xlsynth_vast::VastError> for BlockCodegenError {
fn from(error: xlsynth_vast::VastError) -> Self {
Self::Emission(error.to_string())
}
}
impl From<xlsynth::XlsynthError> for BlockCodegenError {
fn from(error: xlsynth::XlsynthError) -> Self {
Self::Emission(error.to_string())
}
}
impl From<xlsynth_pir::ValueError> for BlockCodegenError {
fn from(error: xlsynth_pir::ValueError) -> Self {
Self::Emission(error.to_string())
}
}