use std::{convert::Infallible, fmt, sync::Arc};
use ic_memory::RuntimeBootstrapError;
#[derive(Clone, Debug)]
pub struct DatabaseBootstrapError {
source: Arc<RuntimeBootstrapError<Infallible>>,
}
impl DatabaseBootstrapError {
#[must_use]
pub fn cause(&self) -> &RuntimeBootstrapError<Infallible> {
&self.source
}
}
impl From<RuntimeBootstrapError<Infallible>> for DatabaseBootstrapError {
fn from(source: RuntimeBootstrapError<Infallible>) -> Self {
Self {
source: Arc::new(source),
}
}
}
impl fmt::Display for DatabaseBootstrapError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.source.fmt(f)
}
}
impl std::error::Error for DatabaseBootstrapError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
Some(self.source.as_ref())
}
}