mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-19 17:39:34 +00:00
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
This commit is contained in:
parent
8b9fb752b6
commit
74630be169
|
@ -543,12 +543,12 @@ rec {
|
||||||
optValues = filter (x: !isNotdef x) (map evalIf defs);
|
optValues = filter (x: !isNotdef x) (map evalIf defs);
|
||||||
in
|
in
|
||||||
if decls == [] then handleOptionSets optionHandler name optAttrs
|
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."
|
if tail decls != [] then throw "Multiple options."
|
||||||
else export opt optValues
|
else export opt optValues
|
||||||
)
|
)
|
||||||
) opts
|
) 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
|
# 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
|
# all options declare and defined. If no values are defined for an
|
||||||
|
@ -646,7 +646,12 @@ rec {
|
||||||
innerModifySumArgs f x (a // b);
|
innerModifySumArgs f x (a // b);
|
||||||
modifySumArgs = f: x: innerModifySumArgs f x {};
|
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;
|
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;
|
debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
|
||||||
|
|
Loading…
Reference in a new issue