pub fn io_at(op: IoOp, path: &Path) -> impl FnOnce(Error) -> AppErrorExpand description
Map a filesystem failure onto the catalogue, keeping the path that failed.
Sixteen call sites across the cache and the rate limiter used to build
ErrorDetail::Io inline with path: None, every one of them holding the
path it had just tried to open. An operator whose disk filled learned which
operation failed and never which file, which is the one fact needed to
act. Routing them through one closure fixes that and puts OS-cause
classification in a single place at the same time.
std::fs::create_dir_all("/tmp/x").map_err(io_at(IoOp::CreateDir, Path::new("/tmp/x")))?;