Restore one encapsulation error

pull/775/head
Yuri Astrakhan 1 year ago
parent e92a43b466
commit bbec57ceb6
  1. 11
      lib/oxigraph/src/storage/error.rs

@ -33,7 +33,12 @@ impl From<StorageError> for io::Error {
/// An error return if some content in the database is corrupted. /// An error return if some content in the database is corrupted.
#[derive(Debug, thiserror::Error)] #[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}")] #[error("{0}")]
Msg(String), Msg(String),
#[error("{0}")] #[error("{0}")]
@ -44,7 +49,7 @@ impl CorruptionError {
/// Builds an error from a printable error message. /// Builds an error from a printable error message.
#[inline] #[inline]
pub(crate) fn new(error: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self { pub(crate) fn new(error: impl Into<Box<dyn Error + Send + Sync + 'static>>) -> Self {
Self::Other(error.into()) CorruptionErrorKind::Other(error.into()).into()
} }
#[inline] #[inline]
@ -62,7 +67,7 @@ impl CorruptionError {
/// Builds an error from a printable error message. /// Builds an error from a printable error message.
#[inline] #[inline]
pub(crate) fn msg(msg: impl Into<String>) -> Self { pub(crate) fn msg(msg: impl Into<String>) -> Self {
Self::Msg(msg.into()) CorruptionErrorKind::Msg(msg.into()).into()
} }
} }

Loading…
Cancel
Save