use std::fmt;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {
Graph(prov_graph::error::Error),
AnchorUnresolved {
view: String,
under: String,
why: String,
},
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Error::Graph(e) => write!(f, "{e}"),
Error::AnchorUnresolved { view, under, why } => write!(
f,
"the view `{view}` is anchored under `{under}`, but {why}"
),
}
}
}
impl std::error::Error for Error {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match self {
Error::Graph(e) => Some(e),
Error::AnchorUnresolved { .. } => None,
}
}
}
impl From<prov_graph::error::Error> for Error {
fn from(error: prov_graph::error::Error) -> Self {
Error::Graph(error)
}
}