about summary refs log tree commit diff
path: root/src/libexpr/eval-inline.hh
diff options
context:
space:
mode:
authorIwan Aucamp <aucampia@gmail.com>2015-07-31T15·32+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-07-31T18·26+0200
commit75837651f15fc3c451ae54afbb5927c1abe329c5 (patch)
tree9fb1f2d2c93d49f6fb7e390a49c0987e235de571 /src/libexpr/eval-inline.hh
parent76cc8e97a2cf3265b39cb6c1b444c7926871f6a0 (diff)
Output line number on infinite recursion
Diffstat (limited to 'src/libexpr/eval-inline.hh')
-rw-r--r--src/libexpr/eval-inline.hh9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libexpr/eval-inline.hh b/src/libexpr/eval-inline.hh
index 178e06c80186..4abc485aa471 100644
--- a/src/libexpr/eval-inline.hh
+++ b/src/libexpr/eval-inline.hh
@@ -1,15 +1,16 @@
 #pragma once
 
 #include "eval.hh"
+#include "shared.hh"
 
 #define LocalNoInline(f) static f __attribute__((noinline)); f
 #define LocalNoInlineNoReturn(f) static f __attribute__((noinline, noreturn)); f
 
 namespace nix {
 
-LocalNoInlineNoReturn(void throwEvalError(const char * s))
+LocalNoInlineNoReturn(void throwEvalError(const FormatOrString & fs))
 {
-    throw EvalError(s);
+    throw EvalError(fs);
 }
 
 LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v))
@@ -24,7 +25,7 @@ LocalNoInlineNoReturn(void throwTypeError(const char * s, const Value & v, const
 }
 
 
-void EvalState::forceValue(Value & v)
+void EvalState::forceValue(Value & v, const Pos & pos)
 {
     if (v.type == tThunk) {
         Env * env = v.thunk.env;
@@ -43,7 +44,7 @@ void EvalState::forceValue(Value & v)
     else if (v.type == tApp)
         callFunction(*v.app.left, *v.app.right, v, noPos);
     else if (v.type == tBlackhole)
-        throwEvalError("infinite recursion encountered");
+        throwEvalError(format("infinite recursion encountered, at %1%") % pos);
 }