pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Failed to parse component: {0}")]
ParseError(String),
#[error("Component validation failed: {0}")]
ValidationError(String),
#[error("Synthesis failed: {0}")]
SynthesisError(String),
#[error("Target not supported: {0}")]
UnsupportedTarget(String),
#[error("Unsupported instruction for target: {0}")]
UnsupportedInstruction(String),
#[error("Memory layout error: {0}")]
MemoryLayoutError(String),
#[error("Hardware protection error: {0}")]
HardwareProtectionError(String),
#[error("IO error: {0}")]
IoError(#[from] std::io::Error),
#[error("{0}")]
Other(String),
}
impl Error {
pub fn parse<S: Into<String>>(msg: S) -> Self {
Error::ParseError(msg.into())
}
pub fn validation<S: Into<String>>(msg: S) -> Self {
Error::ValidationError(msg.into())
}
pub fn synthesis<S: Into<String>>(msg: S) -> Self {
Error::SynthesisError(msg.into())
}
}