summary refs log tree commit diff
path: root/pkgs/lib/default.nix
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2009-01-27 14:46:41 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2009-01-27 14:46:41 +0000
commit74630be1695fe38d9f68115fa7de1f640c992fd2 (patch)
tree976b6825947763201837361a47f3f777093e0f7a /pkgs/lib/default.nix
parent8b9fb752b61960cf142e790c418c14d6f47e7a3e (diff)
downloadnixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar.gz
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar.bz2
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar.lz
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar.xz
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.tar.zst
nixlib-74630be1695fe38d9f68115fa7de1f640c992fd2.zip
Replace addLocation by addErrorContext.
pkgs.lib.addErrorContext add a new line inside the stack trace if this is supported by your nix version.

svn path=/nixpkgs/trunk/; revision=13886
Diffstat (limited to 'pkgs/lib/default.nix')
-rw-r--r--pkgs/lib/default.nix11
1 files changed, 8 insertions, 3 deletions
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix
index cea12bee0a1a..ba91271835e4 100644
--- a/pkgs/lib/default.nix
+++ b/pkgs/lib/default.nix
@@ -543,12 +543,12 @@ rec {
           optValues = filter (x: !isNotdef x) (map evalIf defs);
         in
           if decls == [] then handleOptionSets optionHandler name optAttrs
-          else addLocation "while evaluating the option ${name}:" (
+          else addErrorContext "while evaluating the option ${name}:" (
             if tail decls != [] then throw "Multiple options."
             else export opt optValues
           )
       ) opts
-   else addLocation "while evaluating ${path}:" (notHandle opts);
+   else addErrorContext "while evaluating ${path}:" (notHandle opts);
 
   # Merge option sets and produce a set of values which is the merging of
   # all options declare and defined.  If no values are defined for an
@@ -646,7 +646,12 @@ rec {
 	innerModifySumArgs f x (a // b);
   modifySumArgs = f: x: innerModifySumArgs f x {};
 
-  addLocation = if builtins ? addLocation then builtins.addLocation else msg: val: val;
+  # Wrapper aroung addErrorContext.  The builtin should not be used
+  # directly.
+  addErrorContext =
+    if builtins ? addErrorContext
+    then builtins.addErrorContext
+    else msg: val: val;
 
   debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
   debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;