aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops/fetchMercurial.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/primops/fetchMercurial.cc
parent00e242feed5ac848f5948dd2731bfabe603999ce (diff)
Add error context for most basic coercions
Diffstat (limited to 'src/libexpr/primops/fetchMercurial.cc')
-rw-r--r--src/libexpr/primops/fetchMercurial.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libexpr/primops/fetchMercurial.cc b/src/libexpr/primops/fetchMercurial.cc
index b7f715859..199f7508e 100644
--- a/src/libexpr/primops/fetchMercurial.cc
+++ b/src/libexpr/primops/fetchMercurial.cc
@@ -19,8 +19,6 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar
if (args[0]->type() == nAttrs) {
- state.forceAttrs(*args[0], pos);
-
for (auto & attr : *args[0]->attrs) {
std::string_view n(attr.name);
if (n == "url")
@@ -28,14 +26,14 @@ static void prim_fetchMercurial(EvalState & state, const Pos & pos, Value * * ar
else if (n == "rev") {
// Ugly: unlike fetchGit, here the "rev" attribute can
// be both a revision or a branch/tag name.
- auto value = state.forceStringNoCtx(*attr.value, *attr.pos);
+ auto value = state.forceStringNoCtx(*attr.value, *attr.pos, "While evaluating the `rev` attribute passed to builtins.fetchMercurial");
if (std::regex_match(value.begin(), value.end(), revRegex))
rev = Hash::parseAny(value, htSHA1);
else
ref = value;
}
else if (n == "name")
- name = state.forceStringNoCtx(*attr.value, *attr.pos);
+ name = state.forceStringNoCtx(*attr.value, *attr.pos, "While evaluating the `name` attribute passed to builtins.fetchMercurial");
else
throw EvalError({
.msg = hintfmt("unsupported argument '%s' to 'fetchMercurial'", attr.name),