aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/error.hh
AgeCommit message (Collapse)Author
2023-04-07Finish converting existing comments for internal API docs (#8146)John Ericson
* Finish converting existing comments for internal API docs 99% of this was just reformatting existing comments. Only two exceptions: - Expanded upon `BuildResult::status` compat note - Split up file-level `symbol-table.hh` doc comments to get per-definition docs Also fixed a few whitespace goofs, turning leading tabs to spaces and removing trailing spaces. Picking up from #8133 * Fix two things from comments * Use triple-backtick not indent for `dumpPath` * Convert GNU-style `\`..'` quotes to markdown style in API docs This will render correctly.
2023-03-31Ensure all headers have `#pragma once` and are in API docsJohn Ericson
`///@file` makes them show up in the internal API dos. A tiny few were missing `#pragma once`.
2023-03-31Extend internal API docs, part 2John Ericson
Picking up from #8111. Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2023-01-24Fix 'destructor called on non-final ...' warningGuillaume Maudoux
clangStdenv compiles with a single warning: ``` warning: destructor called on non-final 'nix::PosAdapter' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor] ``` This fixes the warning by making the destructor of PosAdapter virtual, deffering to the correct destructor from the concrete child classes. This has no impact in the end, as none of these classes have specific destructors. Technicaly, it may be faster not to have this indirection, but as per the warning, there is only one place where we have to delete abstract PosAdapter values. Not worth bikesheding I guess.
2023-01-19Revert "Revert "Merge pull request #6204 from layus/coerce-string""Guillaume Maudoux
This reverts commit 9b33ef3879a764bed4cc2404a08344c3a697a646.
2023-01-18Revert "Merge pull request #6204 from layus/coerce-string"Robert Hensing
This reverts commit a75b7ba30f1e4f8b15e810fd18e63ee9552e0815, reversing changes made to 9af16c5f742300e831a2cc400e43df1e22f87f31.
2023-01-02Merge remote-tracking branch 'origin/master' into coerce-stringEelco Dolstra
2022-12-13Introduce AbstractPosEelco Dolstra
This makes the position object used in exceptions abstract, with a method getSource() to get the source code of the file in which the error originated. This is needed for lazy trees because source files don't necessarily exist in the filesystem, and we don't want to make libutil depend on the InputAccessor type in libfetcher.
2022-10-25Rework error throwing, and test itGuillaume Maudoux
2022-10-17Initial frames supportGuillaume Maudoux
2022-09-07WIP: broken merge but need a git checkpointGuillaume Maudoux
2022-07-19error.hh: add additional constructor with explicit errno argumentAdam Joseph
2022-04-29spacingBen Burdette
2022-04-29Merge remote-tracking branch 'origin/master' into coerce-stringGuillaume Maudoux
2022-04-28Merge branch 'master' into debug-merge-masterBen Burdette
2022-04-21don't use Symbol in Pos to represent a pathpennae
PosTable deduplicates origin information, so using symbols for paths is no longer necessary. moving away from path Symbols also reduces the usage of symbols for things that are not keys in attribute sets, which will become important in the future when we turn symbols into indices as well.
2022-04-15Merge branch 'master' into debug-exploratory-PRBen Burdette
2022-04-08Error: Remove unused sname() methodEelco Dolstra
2022-04-08Remove unused Error.name fieldEelco Dolstra
2022-04-07Merge remote-tracking branch 'upstream/master' into upstream-mergeBen Burdette
2022-03-30libutil: Change return value of addTrace to voidDaniel Pauls
The return value of BaseError::addTrace(...) is never used and error-prone as subclasses calling it will return a BaseError instead of the subclass. This commit changes its return value to be void.
2022-03-18Merge remote-tracking branch 'origin/master' into coerce-stringGuillaume Maudoux
2022-03-18Refactor to use more traces and less string manipulationsGuillaume Maudoux
2022-03-11Merge pull request #5865 from pennae/memory-friendlinessEelco Dolstra
be more memory friendly
2022-03-08make Pos smallerpennae
reduces peak hep memory use on eval of our test system from 264.4MB to 242.3MB, possibly also a slight performance boost. theoretically memory use could be cut down by another eight bytes per Pos on average by turning it into a tuple containing an index into a global base position table with row and column offsets, but that doesn't seem worth the effort at this point.
2022-03-07Implement a suggestions mechanismregnat
Each `Error` class now includes a set of suggestions, and these are printed by the top-level handler.
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-04Merge branch 'master' into debug-stepBen Burdette
2022-01-17serialise.hh: Use std::string_viewEelco Dolstra
2021-12-22stack traces basically workingBen Burdette
2021-09-13printEnvPosChainBen Burdette
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