about summary refs log tree commit diff
path: root/tvix/eval/src/compiler
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2022-10-20T22·52+0200
committerclbot <clbot@tvl.fyi>2022-10-21T00·11+0000
commit64bb501de1d52ce004d530d1fc15392537ee2beb (patch)
tree40ffd435406f3235cbb323e98cfcd2ad8d02084a /tvix/eval/src/compiler
parent5753fc14f5a24b2c4d5f4c76ed22d28a1be67c2a (diff)
fix(tvix): distinguish search- and relative path resolution errors r/5172
Failures to resolve a nix search path lookup in angle brackets can be
caught using tryEval (if it reaches the runtime). Resolving relative
paths (either to the current directory or the current user's home) can
never be caught, even if they happen inside a thunk at runtime (which is
currently the case for home-relative paths).

Change-Id: I7f73221df66d82a381dd4063358906257826995a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/7025
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: Adam Joseph <adam@westernsemico.com>
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to 'tvix/eval/src/compiler')
-rw-r--r--tvix/eval/src/compiler/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs
index 819a37ec71eb..619445f2ce85 100644
--- a/tvix/eval/src/compiler/mod.rs
+++ b/tvix/eval/src/compiler/mod.rs
@@ -115,7 +115,7 @@ impl<'observer> Compiler<'observer> {
             Some(dir) if cfg!(target_arch = "wasm32") || dir.is_absolute() => Ok(dir),
             _ => {
                 let current_dir = std::env::current_dir().map_err(|e| Error {
-                    kind: ErrorKind::PathResolution(format!(
+                    kind: ErrorKind::RelativePathResolution(format!(
                         "could not determine current directory: {}",
                         e
                     )),
@@ -290,7 +290,7 @@ impl Compiler<'_> {
             if raw_path.len() == 2 {
                 return self.emit_error(
                     node,
-                    ErrorKind::PathResolution("Empty <> path not allowed".into()),
+                    ErrorKind::NixPathResolution("Empty <> path not allowed".into()),
                 );
             }
             let path = &raw_path[1..(raw_path.len() - 1)];