use std::error::Error;
use std::fmt::{Display, Formatter};
#[derive(Debug)]
pub enum CircuitError {
Generic(String),
}
impl CircuitError {
pub fn new<S>(msg: S) -> Self
where
S: Into<String>,
{
Self::Generic(msg.into())
}
}
pub type CircuitResult<T> = Result<T, CircuitError>;
impl Error for CircuitError {}
impl Display for CircuitError {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
Self::Generic(msg) => write!(f, "{}", msg),
}
}
}