From 64bb501de1d52ce004d530d1fc15392537ee2beb Mon Sep 17 00:00:00 2001 From: sterni Date: Fri, 21 Oct 2022 00:52:36 +0200 Subject: fix(tvix): distinguish search- and relative path resolution errors 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 Reviewed-by: Adam Joseph Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/nix_search_path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tvix/eval/src/nix_search_path.rs') diff --git a/tvix/eval/src/nix_search_path.rs b/tvix/eval/src/nix_search_path.rs index b19c5c1dd5cf..8295aaa0ef91 100644 --- a/tvix/eval/src/nix_search_path.rs +++ b/tvix/eval/src/nix_search_path.rs @@ -103,7 +103,7 @@ impl NixSearchPath { return Ok(p); } } - Err(ErrorKind::PathResolution(format!( + Err(ErrorKind::NixPathResolution(format!( "path '{}' was not found in the Nix search path", path.display() ))) @@ -178,7 +178,7 @@ mod tests { let nix_search_path = NixSearchPath::from_str("./.").unwrap(); let err = nix_search_path.resolve("nope").unwrap_err(); assert!( - matches!(err, ErrorKind::PathResolution(..)), + matches!(err, ErrorKind::NixPathResolution(..)), "err = {err:?}" ); } -- cgit 1.4.1