lix/src/libexpr
Eelco Dolstra 8d4268d190 Improve error formatting
Changes:

* The divider lines are gone. These were in practice a bit confusing,
  in particular with --show-trace or --keep-going, since then there
  were multiple lines, suggesting a start/end which wasn't the case.

* Instead, multi-line error messages are now indented to align with
  the prefix (e.g. "error: ").

* The 'description' field is gone since we weren't really using it.

* 'hint' is renamed to 'msg' since it really wasn't a hint.

* The error is now printed *before* the location info.

* The 'name' field is no longer printed since most of the time it
  wasn't very useful since it was just the name of the exception (like
  EvalError). Ideally in the future this would be a unique, easily
  googleable error ID (like rustc).

* "trace:" is now just "…". This assumes error contexts start with
  something like "while doing X".

Example before:

  error: --- AssertionError ---------------------------------------------------------------------------------------- nix
  at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix

       6|
       7|   x = assert false; 1;
        |       ^
       8|

  assertion 'false' failed
  ----------------------------------------------------- show-trace -----------------------------------------------------
  trace: while evaluating the attribute 'x' of the derivation 'hello-2.10'
  at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix

     191|         // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
     192|           name = "${attrs.pname}-${attrs.version}";
        |           ^
     193|         } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {

Example after:

  error: assertion 'false' failed

         at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix

              6|
              7|   x = assert false; 1;
               |       ^
              8|

         … while evaluating the attribute 'x' of the derivation 'hello-2.10'

         at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix

            191|         // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) {
            192|           name = "${attrs.pname}-${attrs.version}";
               |           ^
            193|         } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
2021-01-21 11:02:09 +01:00
..
flake Fix gcc10 build 2021-01-15 10:41:35 +01:00
primops Improve error formatting 2021-01-21 11:02:09 +01:00
attr-path.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
attr-path.hh Some backports from the flakes branch 2020-06-18 14:03:00 +02:00
attr-set.cc Replace Value type setters with mk* functions 2020-12-18 21:48:22 +01:00
attr-set.hh Improve error formatting 2021-01-21 11:02:09 +01:00
common-eval-args.cc Convert option descriptions to Markdown 2021-01-13 14:18:04 +01:00
common-eval-args.hh Fix --override-flake and add a test 2020-01-22 20:00:58 +01:00
eval-cache.cc Fixup 2020-12-28 19:40:04 -06:00
eval-cache.hh Shut up some clang warnings 2020-10-06 14:52:30 +02:00
eval-inline.hh Improve error formatting 2021-01-21 11:02:09 +01:00
eval.cc Improve error formatting 2021-01-21 11:02:09 +01:00
eval.hh Move <nix/fetchurl.nix> into the nix binary 2020-12-22 14:43:20 +01:00
fetchurl.nix Move <nix/fetchurl.nix> into the nix binary 2020-12-22 14:43:20 +01:00
function-trace.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
function-trace.hh Hide FunctionCallTrace constructor/destructor 2020-01-05 16:21:34 +01:00
get-drvs.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
get-drvs.hh Squashed get CA derivations building 2020-08-07 19:51:55 +00:00
imported-drv-to-derivation.nix Move some corepkgs into the nix binary 2020-03-11 16:57:48 +01:00
json-to-value.cc Bump nlohmann-json version to 3.9.1 2020-09-21 14:24:43 -04:00
json-to-value.hh Fix extra ; warnings involving MakeError 2019-11-10 11:24:47 -05:00
lexer.l Remove an unknown pragma gcc warning 2020-12-02 14:33:20 +01:00
local.mk Move <nix/fetchurl.nix> into the nix binary 2020-12-22 14:43:20 +01:00
nix-expr.pc.in pkg-config files: Use c++17 2019-03-14 14:11:12 +01:00
nixexpr.cc Improve error formatting 2021-01-21 11:02:09 +01:00
nixexpr.hh Improve error formatting 2021-01-21 11:02:09 +01:00
parser.y Improve error formatting 2021-01-21 11:02:09 +01:00
primops.cc Improve error formatting 2021-01-21 11:02:09 +01:00
primops.hh Add missing #pragma once 2020-10-06 10:40:07 +02:00
symbol-table.hh nix flake show: Use evaluation cache 2020-04-17 01:02:29 +02:00
value-to-json.cc Rename Value::normalType() -> Value::type() 2020-12-17 14:45:45 +01:00
value-to-json.hh nix path-info: Add --json flag 2016-08-29 17:29:24 +02:00
value-to-xml.cc Rename Value::normalType() -> Value::type() 2020-12-17 14:45:45 +01:00
value-to-xml.hh Use "#pragma once" to prevent repeated header file inclusion 2012-07-18 14:59:03 -04:00
value.hh Replace Value type setters with mk* functions 2020-12-18 21:48:22 +01:00