summaryrefslogtreecommitdiffstats
path: root/unwind.c
diff options
context:
space:
mode:
Diffstat (limited to 'unwind.c')
-rw-r--r--unwind.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index f447bb07..fc703fc3 100644
--- a/unwind.c
+++ b/unwind.c
@@ -38,6 +38,8 @@
#include "stream.h"
#include "txr.h"
#include "signal.h"
+#include "eval.h"
+#include "parser.h"
#include "unwind.h"
static uw_frame_t *uw_stack;
@@ -275,10 +277,18 @@ val uw_throw(val sym, val exception)
if (opt_loglevel >= 1) {
val s = stringp(exception);
+ val info = if2(source_loc(last_form_evaled),
+ source_loc_str(last_form_evaled));
format(std_error, lit("~a: unhandled exception of type ~a:\n"),
prog_string, sym, nao);
+
+ if (info && sym != eval_error_s)
+ format(std_error, lit("~a: possibly triggered by ~a\n"),
+ prog_string, info, nao);
+
format(std_error, s ? lit("~a: ~a\n") : lit("~a: ~s\n"),
prog_string, exception, nao);
+
}
if (uw_exception_subtype_p(sym, query_error_s) ||
uw_exception_subtype_p(sym, file_error_s)) {