From 74630be1695fe38d9f68115fa7de1f640c992fd2 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Tue, 27 Jan 2009 14:46:41 +0000 Subject: [PATCH] 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 --- pkgs/lib/default.nix | 11 ++++++++--- 1 file 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;