about summary refs log tree commit diff
path: root/tvix/eval
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-05-21T08·08+0300
committerflokli <flokli@flokli.de>2023-05-22T09·43+0000
commitb4bb9062eaa14e654f51a20b7c94656f7cd49858 (patch)
treec7c5e2a2a02d51d7dbaf5889bfb90d15cfb64515 /tvix/eval
parentb7ab6c08561143df9ab6eb2255a74c37719f48f2 (diff)
fix(tvix/eval): add path where useful to ErrorKind::IO r/6172
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>
Diffstat (limited to 'tvix/eval')
-rw-r--r--tvix/eval/src/nix_search_path.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/tvix/eval/src/nix_search_path.rs b/tvix/eval/src/nix_search_path.rs
index 5a650a55c7ba..8e23c2d9c24b 100644
--- a/tvix/eval/src/nix_search_path.rs
+++ b/tvix/eval/src/nix_search_path.rs
@@ -48,7 +48,12 @@ fn canonicalise(path: PathBuf) -> Result<PathBuf, ErrorKind> {
         path
     } else {
         // 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();
 
@@ -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))
         } else {
             Ok(None)