From bbec57ceb6171e2c2f04accee10e7b2a7f9d40ad Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 9 Feb 2024 20:06:44 -0500 Subject: [PATCH] Restore one encapsulation error --- lib/oxigraph/src/storage/error.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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() } }