From 6863ad4c280d0235a7bf21043cc1196bc8655931 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Fri, 3 Feb 2017 12:06:28 -0800 Subject: Dump deferred warnings when eval exception thrown. * eval.c (eval-exception): Call uw_dump_deferred_warnings before throwing exception. The warnings could provide valuable clues about the cause of the error. * share/txr/stdlib/error.tl (compile-error): Likewise. --- eval.c | 2 ++ share/txr/stdlib/error.tl | 1 + 2 files changed, 3 insertions(+) diff --git a/eval.c b/eval.c index 87266f17..1c5855ae 100644 --- a/eval.c +++ b/eval.c @@ -225,6 +225,8 @@ noreturn static void eval_exception(val sym, val ctx, val fmt, va_list vl) (void) vformat(stream, fmt, vl); + uw_dump_deferred_warnings(std_error); + uw_throw(sym, get_string_from_stream(stream)); } diff --git a/share/txr/stdlib/error.tl b/share/txr/stdlib/error.tl index 355b39e6..12bda9ae 100644 --- a/share/txr/stdlib/error.tl +++ b/share/txr/stdlib/error.tl @@ -31,6 +31,7 @@ (defun compile-error (ctx fmt . args) (let ((loc (sys:loc ctx)) (name (sys:ctx-name ctx))) + (dump-deferred-warnings *stderr*) (throwf 'eval-error `@loc~s: @fmt` name . args))) (defun compile-warning (ctx fmt . args) -- cgit v1.2.3