use std::error::Error;
use std::fmt;
#[derive(Debug)]
pub enum CollectionDiscoveryError<RecordsError> {
Records(RecordsError),
}
impl<RecordsError> fmt::Display for CollectionDiscoveryError<RecordsError>
where
RecordsError: fmt::Display,
{
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Records(error) => write!(f, "failed to enumerate collection records: {error}"),
}
}
}
impl<RecordsError> Error for CollectionDiscoveryError<RecordsError>
where
RecordsError: Error + 'static,
{
fn source(&self) -> Option<&(dyn Error + 'static)> {
match self {
Self::Records(error) => Some(error),
}
}
}