diff_trees/error/
traverse.rs1use std::fmt::Display;
2use std::path::Path;
3use std::path::PathBuf;
4
5#[derive(Debug)]
7pub struct TraverseError {
8    pub(crate) path: PathBuf,
9    pub(crate) inner: walkdir::Error,
10}
11
12impl TraverseError {
13    pub fn path(&self) -> &Path {
15        &self.path
16    }
17}
18
19impl Display for TraverseError {
20    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21        write!(
22            f,
23            "Failed to traverse `{}`: {}",
24            self.path.display(),
25            self.inner
26        )
27    }
28}
29
30impl std::error::Error for TraverseError {
31    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
32        Some(&self.inner)
33    }
34}