use crate::aig::U;
use std::num::ParseIntError;
use sv_parser::Locate;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum VerilogError {
#[error("Parsing int error {0} `{1:?}`")]
ParseIntError(ParseIntError, Locate),
#[error("Parsing string error {0:?}")]
ParseStrError(Locate),
#[error("Unexpected RefNode {0:?} `{1}`")]
UnexpectedRefNode(Locate, String),
#[error("Missing RefNode `{0}`")]
MissingRefNode(String),
#[error(" `{1}` : {0:?}")]
SafetyNetError(Option<Locate>, safety_net::Error),
#[error("{0:?}")]
ParserError(#[from] sv_parser::Error),
#[error(" `{1}` : {0:?}")]
Other(Option<Locate>, String),
}
#[derive(Error, Debug)]
pub enum AigError {
#[error("Contains bad state properties `{0:?}`")]
ContainsBadStates(Vec<U>),
#[error("Contains latches `{0:?}`")]
ContainsLatches(Vec<U>),
#[error("Attempted aig contains cycles")]
ContainsCycle,
#[error("Attempted aig contains gates besides AND and INV")]
ContainsOtherGates,
#[error("Attempted aig has disconnected gates.")]
DisconnectedGates,
#[error("Safety net error `{0}`")]
SafetyNetError(#[from] safety_net::Error),
#[error("flussab error `{0}`")]
FlussabError(#[from] flussab_aiger::aig::AigStructureError<crate::aig::U>),
#[error("IO error `{0}`")]
IoError(#[from] std::io::Error),
}