lix/src/libstore
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 Improve error formatting 2021-01-21 11:02:09 +01:00
builtins Improve error formatting 2021-01-21 11:02:09 +01:00
binary-cache-store.cc Fix BinaryCacheStore::registerDrvOutput 2020-12-16 10:54:36 +01:00
binary-cache-store.hh Overhaul store subclassing 2020-12-20 15:47:14 +00:00
builtins.hh buildenv: Eliminate global variables, other cleanup 2020-03-24 14:06:47 +01:00
ca-specific-schema.sql Rework the db schema for derivation outputs 2020-12-11 20:41:32 +01:00
content-address.cc Style fixes 2020-09-22 11:40:19 +02:00
content-address.hh Add ContentAddressMethod and parse/render it 2020-09-17 20:21:04 +02:00
crypto.cc Make sodium a required dependency 2021-01-06 17:56:53 +01:00
crypto.hh crypto.cc: API cleanup and add generate() / to_string() methods 2021-01-06 17:04:46 +01:00
daemon.cc Store metadata about drv outputs realisations 2020-12-11 20:41:32 +01:00
daemon.hh Add missing #pragma once 2020-10-06 10:40:07 +02:00
derivations.cc Fix the detection of already built drv outputs 2020-12-17 11:35:24 +01:00
derivations.hh Fix the detection of already built drv outputs 2020-12-17 11:35:24 +01:00
dummy-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
export-import.cc nix::worker_proto -> worker_proto 2020-09-30 00:41:18 +00:00
filetransfer.cc Improve error formatting 2021-01-21 11:02:09 +01:00
filetransfer.hh Add 'nix store prefetch-{file,tarball}' 2021-01-07 21:51:46 +01:00
fs-accessor.hh Use the fs accessor for readInvalidDerivation 2020-12-15 20:10:46 +01:00
gc.cc Handle amount of disk space saved by hard linking being negative 2020-10-12 16:06:38 +00:00
globals.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
globals.hh Merge pull request #4310 from matthewbauer/rosetta2-extra-platforms 2021-01-06 11:31:13 +01:00
http-binary-cache-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
legacy-ssh-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
local-binary-cache-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
local-fs-store.cc Use the fs accessor for readInvalidDerivation 2020-12-15 20:10:46 +01:00
local-fs-store.hh Overhaul store subclassing 2020-12-20 15:47:14 +00:00
local-store.cc Improve error formatting 2021-01-21 11:02:09 +01:00
local-store.hh Add 'nix store repair' command 2021-01-13 23:27:39 +01:00
local.mk Rework the db schema for derivation outputs 2020-12-11 20:41:32 +01:00
lock.cc Trim lock.cc 2020-10-11 16:44:19 +00:00
lock.hh Trim lock.hh 2020-10-11 16:44:07 +00:00
machines.cc Make system-features a store setting 2020-08-12 18:13:00 +00:00
machines.hh Make system-features a store setting 2020-08-12 18:13:00 +00:00
misc.cc Move Callback into its own header 2020-09-21 18:42:21 +02:00
names.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
names.hh Don't include <regex> in header files 2020-09-21 18:22:45 +02:00
nar-accessor.cc Use the fs accessor for readInvalidDerivation 2020-12-15 20:10:46 +01:00
nar-accessor.hh NarAccessor: Run in constant memory 2020-07-13 17:30:42 +02:00
nar-info-disk-cache.cc --refresh: Imply setting .narinfo disk cache TTL to 0 2021-01-18 14:38:31 +01:00
nar-info-disk-cache.hh Misc changes from the flakes branch 2020-03-24 14:34:47 +01:00
nar-info.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
nar-info.hh Minimize the usage of Hash::dummy 2020-08-06 18:31:48 +00:00
nix-store.pc.in
optimise-store.cc Improve error formatting 2021-01-21 11:02:09 +01:00
parsed-derivations.cc Don't let 'preferLocalBuild' override 'max-jobs=0' 2021-01-12 01:28:00 +01:00
parsed-derivations.hh Add missing #pragma once 2020-10-06 10:40:07 +02:00
path-info.hh LocalStore: Get rid of recursive_mutex 2020-11-03 14:45:24 +01:00
path.cc toStorePath(): Return a StorePath and the suffix 2020-07-13 16:25:48 +02:00
path.hh Merge remote-tracking branch 'origin/master' into substitute-other-storedir 2020-07-02 11:14:04 -04:00
pathlocks.cc convert some printError calls to logError 2020-05-03 08:01:25 -06:00
pathlocks.hh
profiles.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
profiles.hh createGeneration(): Take a StorePath 2020-09-03 11:06:56 +02:00
realisation.cc Use the hash modulo in the derivation outputs 2020-12-11 21:17:23 +01:00
realisation.hh Use the hash modulo in the derivation outputs 2020-12-11 21:17:23 +01:00
references.cc scanForReferences: Remove misleading comment 2020-12-28 17:21:19 +01:00
references.hh Sink: Use std::string_view 2020-12-02 14:17:27 +01:00
remote-fs-accessor.cc Use the fs accessor for readInvalidDerivation 2020-12-15 20:10:46 +01:00
remote-fs-accessor.hh Use the fs accessor for readInvalidDerivation 2020-12-15 20:10:46 +01:00
remote-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
remote-store.hh Overhaul store subclassing 2020-12-20 15:47:14 +00:00
s3-binary-cache-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
s3-binary-cache-store.hh Overhaul store subclassing 2020-12-20 15:47:14 +00:00
s3.hh DataTransfer -> FileTransfer 2020-04-08 22:26:57 +02:00
sandbox-defaults.sb sandbox: fix /bin/sh on catalina 2020-03-20 22:12:30 +01:00
sandbox-minimal.sb
sandbox-network.sb
schema.sql
serve-protocol.hh
sqlite.cc Improve error formatting 2021-01-21 11:02:09 +01:00
sqlite.hh Merge remote-tracking branch 'origin/master' into flakes 2020-06-17 10:26:52 +02:00
ssh-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
ssh.cc Revert the enum struct change 2020-06-18 22:11:26 +00:00
ssh.hh
store-api.cc string2Int(): Return std::optional 2021-01-08 12:22:21 +01:00
store-api.hh Add 'nix store repair' command 2021-01-13 23:27:39 +01:00
uds-remote-store.cc Overhaul store subclassing 2020-12-20 15:47:14 +00:00
uds-remote-store.hh Overhaul store subclassing 2020-12-20 15:47:14 +00:00
worker-protocol.hh Store metadata about drv outputs realisations 2020-12-11 20:41:32 +01:00