diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-04-05 22:27:41 +0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2004-04-05 22:27:41 +0000 |
commit | 59b94ee18ac0cba5c7b261ee72550a4d3db0acb5 (patch) | |
tree | 9dbe6721699439cda3ce68ac86acbe38e9839e66 /src/libexpr/nixexpr.hh | |
parent | a520b1cbc3327dfb8e3c6f503dfd0bd41e0a6d55 (diff) | |
download | guix-59b94ee18ac0cba5c7b261ee72550a4d3db0acb5.tar.gz |
* When something goes wrong in the evaluation of a Nix expression,
print a nice backtrace of the stack, rather than vomiting a gigantic (and useless) aterm on the screen. Example: error: while evaluating file `.../pkgs/system/test.nix': while evaluating attribute `subversion' at `.../pkgs/system/all-packages-generic.nix', line 533: while evaluating function at `.../pkgs/applications/version-management/subversion/default.nix', line 1: assertion failed at `.../pkgs/applications/version-management/subversion/default.nix', line 13 Since the Nix expression language is lazy, the trace may be misleading. The purpose is to provide a hint as to the location of the problem.
Diffstat (limited to 'src/libexpr/nixexpr.hh')
-rw-r--r-- | src/libexpr/nixexpr.hh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 924f8b912f..ecd2534088 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -52,6 +52,9 @@ private: ATerm string2ATerm(const string & s); string aterm2String(ATerm t); +/* Show a position. */ +string showPos(ATerm pos); + /* Generic bottomup traversal over ATerms. The traversal first recursively descends into subterms, and then applies the given term function to the resulting term. */ @@ -63,11 +66,12 @@ ATerm bottomupRewrite(TermFun & f, ATerm e); /* Query all attributes in an attribute set expression. The expression must be in normal form. */ -void queryAllAttrs(Expr e, ATermMap & attrs); +void queryAllAttrs(Expr e, ATermMap & attrs, bool withPos = false); /* Query a specific attribute from an attribute set expression. The expression must be in normal form. */ Expr queryAttr(Expr e, const string & name); +Expr queryAttr(Expr e, const string & name, ATerm & pos); /* Create an attribute set expression from an Attrs value. */ Expr makeAttrs(const ATermMap & attrs); |