diff --git a/lib/oxigraph/src/storage/error.rs b/lib/oxigraph/src/storage/error.rs index 26322353..13a257f8 100644 --- a/lib/oxigraph/src/storage/error.rs +++ b/lib/oxigraph/src/storage/error.rs @@ -33,7 +33,12 @@ impl From for io::Error { /// An error return if some content in the database is corrupted. #[derive(Debug, thiserror::Error)] -pub enum CorruptionError { +#[error(transparent)] +pub struct CorruptionError(#[from] CorruptionErrorKind); + +/// An error return if some content in the database is corrupted. +#[derive(Debug, thiserror::Error)] +enum CorruptionErrorKind { #[error("{0}")] Msg(String), #[error("{0}")] @@ -44,7 +49,7 @@ impl CorruptionError { /// Builds an error from a printable error message. #[inline] pub(crate) fn new(error: impl Into>) -> Self { - Self::Other(error.into()) + CorruptionErrorKind::Other(error.into()).into() } #[inline] @@ -62,7 +67,7 @@ impl CorruptionError { /// Builds an error from a printable error message. #[inline] pub(crate) fn msg(msg: impl Into) -> Self { - Self::Msg(msg.into()) + CorruptionErrorKind::Msg(msg.into()).into() } }