lix/doc/manual/rl-next
Qyriad 14bf54bd39 trace which part of foo.bar.baz errors
Turns errors like:

let
  somepkg.src = throw "invalid foobar";
in somepkg.src.meta

error:
       … while evaluating the attribute 'src.meta'
         at «string»:2:3:
            1| let
            2|   somepkg.src = throw "invalid foobar";
             |   ^
            3| in somepkg.src.meta

       … while calling the 'throw' builtin
         at «string»:2:17:
            1| let
            2|   somepkg.src = throw "invalid foobar";
             |                 ^
            3| in somepkg.src.meta

       error: invalid foobar

into errors like:

let
  somepkg.src = throw "invalid foobar";
in somepkg.src.meta

error:
       … while evaluating the attribute 'src.meta'
         at «string»:2:3:
            1| let
            2|   somepkg.src = throw "invalid foobar";
             |   ^
            3| in somepkg.src.meta

       … while evaluating 'somepkg.src' to select 'meta' on it
         at «string»:3:4:
            2|   somepkg.src = throw "invalid foobar";
            3| in somepkg.src.meta
             |    ^

       … while calling the 'throw' builtin
         at «string»:2:17:
            1| let
            2|   somepkg.src = throw "invalid foobar";
             |                 ^
            3| in somepkg.src.meta

       error: invalid foobar

And for type errors, from:

let
  somepkg.src = "I'm not an attrset";
in somepkg.src.meta

error:
       … while evaluating the attribute 'src.meta'
         at «string»:2:3:
            1| let
            2|   somepkg.src = "I'm not an attrset";
             |   ^
            3| in somepkg.src.meta

       … while selecting an attribute
         at «string»:3:4:
            2|   somepkg.src = "I'm not an attrset";
            3| in somepkg.src.meta
             |    ^

       error: expected a set but found a string: "I'm not an attrset"

into:

let
  somepkg.src = "I'm not an attrset";
in somepkg.src.meta

error:
       … while evaluating the attribute 'src.meta'
         at «string»:2:3:
            1| let
            2|   somepkg.src = "I'm not an attrset";
             |   ^
            3| in somepkg.src.meta

       … while selecting 'meta' on 'somepkg.src'
         at «string»:3:4:
            2|   somepkg.src = "I'm not an attrset";
            3| in somepkg.src.meta
             |    ^

       error: expected a set but found a string: "I'm not an attrset"

For the low price of an enumerate() and a lambda you too can have the
incorrect line of code actually show up in the trace!

Change-Id: Ic1491c86e33c167891bdac9adad6224784760bd6
2024-07-04 17:42:35 -06:00
..
.gitkeep release: release notes for 2.90.0 2024-06-15 18:46:18 -07:00
better-attrpath-errors.md trace which part of foo.bar.baz errors 2024-07-04 17:42:35 -06:00
build-dir.md Add build-dir setting, clean up default TMPDIR handling 2024-06-24 11:30:32 +03:00
fod-failure-includes-url.md store: guess the URL of failing fixed-output derivations 2024-06-27 22:44:16 -07:00
multiline-log-format.md libmain: add progress bar with multiple status lines 2024-06-22 14:20:27 +02:00
nix-copy-is-fast.md Add some release notes for things we did 2024-06-24 16:26:12 -07:00
old-protocol-removal.md Add some release notes for things we did 2024-06-24 16:26:12 -07:00
registry-add-shorthand-only.md Reject fully-qualified URLs in 'from' argument of nix registry add 2024-06-29 05:11:31 +00:00
reject-flake-config.md libexpr/flake: allow automatic rejection of configuration options from flakes 2024-06-30 19:28:14 +02:00
repl-complete-colon.md repl: implement tab completing :colon commands 2024-06-17 13:08:02 +00:00
sanitizers.md Add some release notes for things we did 2024-06-24 16:26:12 -07:00