Fork of https://github.com/oxigraph/oxigraph.git for the purpose of NextGraph project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
oxigraph/lib/src/model/error.rs

37 lines
728 B

use rio_api::iri::IriParseError;
use std::error;
use std::fmt;
#[derive(Debug)]
pub struct ModelError {
inner: ErrorKind,
}
impl fmt::Display for ModelError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match &self.inner {
ErrorKind::Iri(e) => e.fmt(f),
}
}
}
impl error::Error for ModelError {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match &self.inner {
ErrorKind::Iri(e) => Some(e),
}
}
}
#[derive(Debug)]
enum ErrorKind {
Iri(IriParseError),
}
impl From<IriParseError> for ModelError {
fn from(error: IriParseError) -> Self {
Self {
inner: ErrorKind::Iri(error),
}
}
}