Skip to content
Myr

ignore: always include depth in errors

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Include the depth in I/O errors from WalkDir as well, so that the consumer can handle the error differently depending on depth. For example, this would allow ignoring broken symlinks that don't match certain depth criteria. Note that this could conceivably be a breaking change if callers were previously relying on down-casting nested errors to specific types. There weren't any documented API guarantees around this, but if it breaks too many folks, we'll likely need to back this out. Fixes #3453

authored by Thayne McCombs · committed by GitHub · parent dfe4a81 · Browse files · 1 file+4 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−1 removed

  • other:+4 added−1 removed

1 file+4 added−1 removed

modified:crates/ignore/src/lib.rs+4 added-1 removed
292 unmodified lines
293 }),294 };295 }296 let path = err.path().map(|p| p.to_path_buf());297 let mut ig_err = Error::Io(std::io::Error::from(err));297 let mut ig_err = Error::WithDepth {298 depth,299 err: Box::new(Error::Io(std::io::Error::from(err))),300 };301 if let Some(path) = path {302 ig_err = Error::WithPath { path, err: Box::new(ig_err) };303 }304 ig_err
243 unmodified lines