aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/get-drvs.cc
diff options
context:
space:
mode:
authorGuillaume Maudoux <guillaume.maudoux@tweag.io>2022-03-04 05:04:47 +0100
committerGuillaume Maudoux <guillaume.maudoux@tweag.io>2022-03-04 05:04:47 +0100
commitbe1f0697468bd6c0f2be4f7e058270c161098e9f (patch)
tree0a748b160a40d3ac005af29b4b4d322c459f0e84 /src/libexpr/get-drvs.cc
parent00e242feed5ac848f5948dd2731bfabe603999ce (diff)
Add error context for most basic coercions
Diffstat (limited to 'src/libexpr/get-drvs.cc')
-rw-r--r--src/libexpr/get-drvs.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc
index 7630c5ff4..975490d36 100644
--- a/src/libexpr/get-drvs.cc
+++ b/src/libexpr/get-drvs.cc
@@ -50,7 +50,7 @@ std::string DrvInfo::queryName() const
if (name == "" && attrs) {
auto i = attrs->find(state->sName);
if (i == attrs->end()) throw TypeError("derivation name missing");
- name = state->forceStringNoCtx(*i->value);
+ name = state->forceStringNoCtx(*i->value, noPos, "While evaluating the name of a DrvInfo");
}
return name;
}
@@ -60,7 +60,7 @@ std::string DrvInfo::querySystem() const
{
if (system == "" && attrs) {
auto i = attrs->find(state->sSystem);
- system = i == attrs->end() ? "unknown" : state->forceStringNoCtx(*i->value, *i->pos);
+ system = i == attrs->end() ? "unknown" : state->forceStringNoCtx(*i->value, *i->pos, "While evaluating the system of a DrvInfo");
}
return system;
}
@@ -108,15 +108,15 @@ DrvInfo::Outputs DrvInfo::queryOutputs(bool onlyOutputsToInstall)
/* Get the ‘outputs’ list. */
Bindings::iterator i;
if (attrs && (i = attrs->find(state->sOutputs)) != attrs->end()) {
- state->forceList(*i->value, *i->pos);
+ state->forceList(*i->value, *i->pos, "While evaluating the outputs of a DrvInfo");
/* For each output... */
for (auto elem : i->value->listItems()) {
/* Evaluate the corresponding set. */
- std::string name(state->forceStringNoCtx(*elem, *i->pos));
+ std::string name(state->forceStringNoCtx(*elem, *i->pos, "While evaluating the name of one output of a DrvInfo"));
Bindings::iterator out = attrs->find(state->symbols.create(name));
if (out == attrs->end()) continue; // FIXME: throw error?
- state->forceAttrs(*out->value, *i->pos);
+ state->forceAttrs(*out->value, *i->pos, "While evaluating the description of a DrvInfo output");
/* And evaluate its ‘outPath’ attribute. */
Bindings::iterator outPath = out->value->attrs->find(state->sOutPath);
@@ -151,7 +151,7 @@ std::string DrvInfo::queryOutputName() const
{
if (outputName == "" && attrs) {
Bindings::iterator i = attrs->find(state->sOutputName);
- outputName = i != attrs->end() ? state->forceStringNoCtx(*i->value) : "";
+ outputName = i != attrs->end() ? state->forceStringNoCtx(*i->value, noPos, "While evaluating the output name of a DrvInfo") : "";
}
return outputName;
}
@@ -163,7 +163,7 @@ Bindings * DrvInfo::getMeta()
if (!attrs) return 0;
Bindings::iterator a = attrs->find(state->sMeta);
if (a == attrs->end()) return 0;
- state->forceAttrs(*a->value, *a->pos);
+ state->forceAttrs(*a->value, *a->pos, "While evaluating the `meta` attribute of a DrvInfo");
meta = a->value->attrs;
return meta;
}
@@ -364,7 +364,7 @@ static void getDerivations(EvalState & state, Value & vIn,
`recurseForDerivations = true' attribute. */
if (i->value->type() == nAttrs) {
Bindings::iterator j = i->value->attrs->find(state.sRecurseForDerivations);
- if (j != i->value->attrs->end() && state.forceBool(*j->value, *j->pos))
+ if (j != i->value->attrs->end() && state.forceBool(*j->value, *j->pos, "While evaluating the attribute `recurseForDerivations`"))
getDerivations(state, *i->value, pathPrefix2, autoArgs, drvs, done, ignoreAssertionFailures);
}
}