aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
AgeCommit message (Collapse)Author
2021-01-21Improve error formattingEelco Dolstra
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-15Merge pull request #4240 from bburdette/2259-error-messageDomen Kožar
2259 error message - "auto-call" error
2020-12-10Add lvlNotice log levelEelco Dolstra
This is like syslog's LOG_NOTICE: "normal, but significant, condition".
2020-11-11usage example locationBen Burdette
2020-10-07FormattingEelco Dolstra
2020-07-20Add UnimplementedError to ease grepping for theseCarlo Nucera
2020-07-07Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-07-07Fix coverage buildEelco Dolstra
2020-07-06Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-30comments and cleanupBen Burdette
2020-06-30Merge branch 'master' into add-traceBen Burdette
2020-06-30check for a null symbolBen Burdette
2020-06-27showtrace as function argBen Burdette
2020-06-25showTrace flag for ErrorInfo; showTrace test.Ben Burdette
2020-06-24add trace test; error formatting refinementsBen Burdette
2020-06-24convenience form of addTraceBen Burdette
2020-06-24repl indentingBen Burdette
2020-06-24nixCode -> LinesOfCodeBen Burdette
2020-06-23use plain errPos instead of nixCode; fix testsBen Burdette
2020-06-19addErrorTraceBen Burdette
2020-06-18addTraceBen Burdette
2020-06-18Merge branch 'master' into caveman-LOCsBen Burdette
2020-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-15Add mising #include for strerrorJohn Ericson
2020-06-15Get rid of explicit ErrorInfo constructorsEelco Dolstra
2020-06-08Merge branch 'errors-phase-2' into caveman-LOCsBen Burdette
2020-06-04add some commentsBen Burdette
2020-06-02remove extra space in SysErrorsBen Burdette
2020-05-20print LOC for stdin, string argsBen Burdette
2020-05-14fix compile errorsBen Burdette
2020-05-11fixes to merged codeBen Burdette
2020-05-08add pos to errorinfo, remove from hintsBen Burdette
2020-05-07pretending to be constBen Burdette
2020-05-06implement SysError errno handlingBen Burdette
2020-05-03convert some printError calls to logErrorBen Burdette
2020-04-29errorinfo constructor testBen Burdette
2020-04-28Error classname as nameBen Burdette
2020-04-27astyle formatBen Burdette
2020-04-26error.hhBen Burdette
2020-04-21add ErrorInfo to BaseErrorBen Burdette
2020-04-17demoing other error levels than warn/error; rename line and file fields in ↵Ben Burdette
errPos
2020-04-17logError, logWarning; Logger functions; switch to Verbosity enumBen Burdette
2020-04-16iomanip no longer neededBen Burdette
2020-04-16switch to structs, which don't need public:Ben Burdette
2020-04-15move implementation to ccBen Burdette
2020-04-08commentsBen Burdette
2020-04-08return of NixCodeBen Burdette
2020-04-08initializer styleBen Burdette
2020-04-07columnRange -> columnBen Burdette
2020-04-06comment cleanupBen Burdette