about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2022-12-10 23:36:46 +0100
committerRobert Hensing <robert@roberthensing.nl>2022-12-10 23:36:46 +0100
commit1a44080088c3a4384da7e4529928f7a0a7b1aa4e (patch)
tree64da6a87c736add11b24eaadc01baef95946bc2f /lib
parent5fb20d2f8cad7a6332baafbb2986ac0ef16c6fc7 (diff)
lib.generators.toPretty: Add attribute name to error context
Diffstat (limited to 'lib')
-rw-r--r--lib/generators.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/generators.nix b/lib/generators.nix
index c0fe69389e00d..4c9c2d1e98693 100644
--- a/lib/generators.nix
+++ b/lib/generators.nix
@@ -342,7 +342,10 @@ rec {
       else "{" + introSpace
           + libStr.concatStringsSep introSpace (libAttr.mapAttrsToList
               (name: value:
-                "${libStr.escapeNixIdentifier name} = ${go (indent + "  ") value};") v)
+                "${libStr.escapeNixIdentifier name} = ${
+                  builtins.addErrorContext "while evaluating an attribute `${name}`"
+                    (go (indent + "  ") value)
+                };") v)
         + outroSpace + "}"
     else abort "generators.toPretty: should never happen (v = ${v})";
   in go "";