From 1a44080088c3a4384da7e4529928f7a0a7b1aa4e Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sat, 10 Dec 2022 23:36:46 +0100 Subject: [PATCH] lib.generators.toPretty: Add attribute name to error context --- lib/generators.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/generators.nix b/lib/generators.nix index c0fe69389e00..4c9c2d1e9869 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 "";