aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQyriad <qyriad@qyriad.me>2024-04-10 18:30:12 -0600
committerQyriad <qyriad@qyriad.me>2024-04-10 18:30:12 -0600
commit70af056de8213cc013e1ab48594c936e4bf92a36 (patch)
treed1213419ba2a3a5b138d0fa8a2f16b675e8d5d5c
parent99845e0e01eaa2120b10c22591c43c4305f5ba51 (diff)
don't boost::to_few_args when an eval cached string type errors
Change-Id: Id3cb762622e156ceaf9d5bb95c2c704ffe474d0e
-rw-r--r--src/libexpr/eval-cache.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libexpr/eval-cache.cc b/src/libexpr/eval-cache.cc
index f26e6d724..5969ee449 100644
--- a/src/libexpr/eval-cache.cc
+++ b/src/libexpr/eval-cache.cc
@@ -576,8 +576,9 @@ std::string AttrCursor::getString()
auto & v = forceValue();
- if (v.type() != nString && v.type() != nPath)
- root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr()).debugThrow();
+ if (v.type() != nString && v.type() != nPath) {
+ root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr(), v.type()).debugThrow();
+ }
return v.type() == nString ? v.string.s : v.path().to_string();
}
@@ -622,11 +623,11 @@ string_t AttrCursor::getStringWithContext()
NixStringContext context;
copyContext(v, context);
return {v.string.s, std::move(context)};
- }
- else if (v.type() == nPath)
+ } else if (v.type() == nPath) {
return {v.path().to_string(), {}};
- else
- root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr()).debugThrow();
+ } else {
+ root->state.error<TypeError>("'%s' is not a string but %s", getAttrPathStr(), v.type()).debugThrow();
+ }
}
bool AttrCursor::getBool()