Skip to main content

sloop/
reindex.rs

1use std::fmt;
2use std::io;
3use std::path::Path;
4
5#[derive(Debug)]
6pub struct ReindexError(pub(crate) String);
7
8impl ReindexError {
9    pub(crate) fn io(path: &Path, source: io::Error) -> Self {
10        Self(format!("{}: {source}", path.display()))
11    }
12}
13
14impl fmt::Display for ReindexError {
15    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
16        formatter.write_str(&self.0)
17    }
18}
19
20impl std::error::Error for ReindexError {}