diff options
author | sterni <sternenseemann@systemli.org> | 2021-09-08T21·50+0200 |
---|---|---|
committer | sterni <sternenseemann@systemli.org> | 2021-09-09T12·52+0000 |
commit | 5f9c85a1b53dc025398e00263f87bf87a16950d3 (patch) | |
tree | 3ce971e860398e08cdaaab5c20ab0fcbcbcd6ce7 /nix | |
parent | fab7dd62f48ba0ee312ccd92b54446cd9bfa8e94 (diff) |
refactor(nix/readTree): use throw instead of assertMsg r/2829
This gives a slightly prettier error message and won't leak the error message when builtins.tryEval is used. Currently an error message from the tests is always part of the pipeline evaluation log. Change-Id: I9b488a440368091ed42d707ba4124f592a64bd86 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3502 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
Diffstat (limited to 'nix')
-rw-r--r-- | nix/readTree/default.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/nix/readTree/default.nix b/nix/readTree/default.nix index 7c48d177fb39..f433b2736061 100644 --- a/nix/readTree/default.nix +++ b/nix/readTree/default.nix @@ -66,10 +66,9 @@ let else import path; pathType = builtins.typeOf importedFile; imported = - assert assertMsg - (pathType == "lambda") - "readTree: trying to import ${toString path}, but it’s a ${pathType}, you need to make it a function like { depot, pkgs, ... }"; - importedFile (filter (argsWithPath args parts) parts); + if pathType != "lambda" + then builtins.throw "readTree: trying to import ${toString path}, but it’s a ${pathType}, you need to make it a function like { depot, pkgs, ... }" + else importedFile (filter (argsWithPath args parts) parts); in if (isAttrs imported) then imported // (marker parts) else imported; |