commit cab440923e65a995eec42f3a12ea4fec831e044a
parent e50838f9200c0ce9d73053aa853a81e70edce971
Author: Andres Navarro <canavarro82@gmail.com>
Date: Fri, 29 Apr 2011 16:48:10 -0300
Added source code info to error messages.
Diffstat:
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/src/krepl.c b/src/krepl.c
@@ -143,13 +143,30 @@ void error_fn(klisp_State *K, TValue *xparams, TValue obj)
}
char *msg = kstring_buf(err_obj->msg);
fprintf(stdout, "\n*ERROR*: %s: %s", who_str, msg);
+
+ krooted_tvs_push(K, obj);
+
+ /* Msg + irritants */
+ /* TODO move to a new function */
if (!ttisnil(err_obj->irritants)) {
fprintf(stdout, ": ");
- krooted_tvs_push(K, obj);
kwrite_display_to_port(K, port, err_obj->irritants, false);
- krooted_tvs_pop(K);
}
fprintf(stdout, "\n");
+
+ /* Location */
+ /* TODO move to a new function */
+ /* MAYBE: remove */
+ if (khas_name(who) || khas_si(who)) {
+ fprintf(stdout, "Location: ");
+ kwrite_display_to_port(K, port, who, false);
+ fprintf(stdout, "\n");
+ }
+
+ /* Backtrace */
+ /* TODO move to a new function */
+
+ krooted_tvs_pop(K);
} else {
fprintf(stdout, "\n*ERROR*: not an error object passed to "
"error continuation");