fix(tvix/eval): add path where useful to ErrorKind::IO

These two places didn't add the path from the context to the
ErrorKind, but simply relied on the
impl From<std::io::Error> for tvix_eval::ErrorKind, which doesn't add
the path.

Change-Id: Ifc7dbbe305d24242b0705de1dea34e8923e9d2cb
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8603
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
Florian Klink 2023-05-21 11:08:02 +03:00 committed by flokli
parent b7ab6c0856
commit b4bb9062ea

View file

@ -48,7 +48,12 @@ fn canonicalise(path: PathBuf) -> Result<PathBuf, ErrorKind> {
path path
} else { } else {
// TODO(tazjin): probably panics in wasm? // TODO(tazjin): probably panics in wasm?
std::env::current_dir()?.join(path) std::env::current_dir()
.map_err(|e| ErrorKind::IO {
path: Some(path.clone()),
error: e.into(),
})?
.join(path)
} }
.clean(); .clean();
@ -80,7 +85,10 @@ impl NixSearchPathEntry {
} }
}; };
if io.path_exists(path.clone())? { if io.path_exists(path.clone()).map_err(|e| ErrorKind::IO {
path: Some(path.clone()),
error: e.into(),
})? {
Ok(Some(path)) Ok(Some(path))
} else { } else {
Ok(None) Ok(None)