lix/src
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
..
build-remote Improve error formatting 2021-01-21 11:02:09 +01:00
cpptoml Revert the enum struct change 2020-06-18 22:11:26 +00:00
libexpr Improve error formatting 2021-01-21 11:02:09 +01:00
libfetchers Merge branch 'slashes-in-github-branches' of https://github.com/Ma27/nix 2021-01-18 12:55:06 +01:00
libmain Convert option descriptions to Markdown 2021-01-13 14:18:04 +01:00
libstore Improve error formatting 2021-01-21 11:02:09 +01:00
libutil Improve error formatting 2021-01-21 11:02:09 +01:00
nix Improve error formatting 2021-01-21 11:02:09 +01:00
nix-build Improve error formatting 2021-01-21 11:02:09 +01:00
nix-channel Remove static variable name clashes 2020-10-06 13:49:20 +02:00
nix-collect-garbage Remove static variable name clashes 2020-10-06 13:49:20 +02:00
nix-copy-closure Remove static variable name clashes 2020-10-06 13:49:20 +02:00
nix-env Improve error formatting 2021-01-21 11:02:09 +01:00
nix-instantiate Split out local-fs-store.hh 2020-10-09 20:18:08 +00:00
nix-store Improve error formatting 2021-01-21 11:02:09 +01:00
resolve-system-dependencies lstat() cleanup 2020-09-23 19:17:28 +02:00