about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libexpr/primops.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index a25bd8854e0b..0892d5d1b70e 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -333,15 +333,16 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar
 static void prim_abort(EvalState & state, const Pos & pos, Value * * args, Value & v)
 {
     PathSet context;
-    throw Abort(format("evaluation aborted with the following error message: ‘%1%’") %
-        state.coerceToString(pos, *args[0], context));
+    string s = state.coerceToString(pos, *args[0], context);
+    throw Abort(format("evaluation aborted with the following error message: ‘%1%’") % s);
 }
 
 
 static void prim_throw(EvalState & state, const Pos & pos, Value * * args, Value & v)
 {
     PathSet context;
-    throw ThrownError(format("%1%") % state.coerceToString(pos, *args[0], context));
+    string s = state.coerceToString(pos, *args[0], context);
+    throw ThrownError(s);
 }