summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-23 05:48:21 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-23 05:48:21 -0700
commit312ce645143aa6ba2890b57830523fea98a373e4 (patch)
treecb125cf4fe3b08de42ef817bdecab41066b796b1
parent0b36ee3a4bbfa253670a05c7079420d06b0409d6 (diff)
downloadtxr-312ce645143aa6ba2890b57830523fea98a373e4.tar.gz
txr-312ce645143aa6ba2890b57830523fea98a373e4.tar.bz2
txr-312ce645143aa6ba2890b57830523fea98a373e4.zip
repl: give details about source of error exception.
* parser.c (repl): Print location info for exception based on last_form_evaled and last_form_expanded.
-rw-r--r--parser.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/parser.c b/parser.c
index 221b3562..b56a3d6d 100644
--- a/parser.c
+++ b/parser.c
@@ -720,12 +720,22 @@ val repl(val bindings, val in_stream, val out_stream)
if (uw_exception_subtype_p(exsym, syntax_error_s)) {
put_line(lit("** syntax error"), out_stream);
} else if (uw_exception_subtype_p(exsym, error_s)) {
+ val info = source_loc_str(last_form_evaled, nil);
+ val ex_info = source_loc_str(last_form_expanded, nil);
+
if (cdr(exvals))
format(out_stream, lit("** ~!~a ~!~s\n"),
car(exvals), cdr(exvals), nao);
else
format(out_stream, lit("** ~!~a\n"), car(exvals), nao);
+ if (info && exsym != eval_error_s)
+ format(std_error, lit("** possibly triggered at ~a by form ~!~s\n"),
+ info, last_form_evaled, nao);
+
+ if (ex_info)
+ format(std_error, lit("** during expansion at ~a of form ~!~s\n"),
+ ex_info, last_form_expanded, nao);
} else {
format(out_stream, lit("** ~!~s exception, args: ~!~s\n"),
exsym, exvals, nao);