diff --git a/src/libexpr/primops/fromYAML.cc b/src/libexpr/primops/fromYAML.cc index 642548235..1421b5959 100644 --- a/src/libexpr/primops/fromYAML.cc +++ b/src/libexpr/primops/fromYAML.cc @@ -127,7 +127,7 @@ static RegisterPrimOp primop_fromYAML({ Custom tags are ignored and a stream with multiple documents is mapped to a list except when the stream contains a single document. )", .fun = [] (EvalState & state, const PosIdx pos, Value * * args, Value & val) { - auto yaml = state.forceStringNoCtx(*args[0], pos); + auto yaml = state.forceStringNoCtx(*args[0], pos, "while evaluating the argument passed to builtins.fromYAML"); NixContext context{ .state = state, diff --git a/tests/unit/libexpr/yaml.cc b/tests/unit/libexpr/yaml.cc index ec53d20bb..259c3efdd 100644 --- a/tests/unit/libexpr/yaml.cc +++ b/tests/unit/libexpr/yaml.cc @@ -1,6 +1,6 @@ #ifdef HAVE_RYML -#include "libexprtests.hh" +#include "libexpr.hh" // Ugly, however direct access to the SAX parser is required in order to parse multiple JSON objects from a stream #include "json-to-value.cc" @@ -108,9 +108,9 @@ namespace nix { if (name == "json") { json = attr->value; } else if (name == "yaml") { - yamlRaw = state.forceStringNoCtx(*attr->value); + yamlRaw = state.forceStringNoCtx(*attr->value, noPos, "while interpreting the \"yaml\" field as string"); } else if (name == "fail") { - fail = state.forceBool(*attr->value, noPos); + fail = state.forceBool(*attr->value, noPos, "while interpreting the \"fail\" field as bool"); } } fail |= !json; @@ -126,7 +126,7 @@ namespace nix { jsonStr = "null"; jsonVal.mkNull(); } else { - jsonStr = state.forceStringNoCtx(*json); + jsonStr = state.forceStringNoCtx(*json, noPos, "while interpreting the \"json\" field as string"); } if (!(emptyJSON = jsonStr.empty())) { if (json->type() != nNull) {