~ chicken-core (chicken-5) 3b5cb47d9789134db5395482615b0f29737d873f
commit 3b5cb47d9789134db5395482615b0f29737d873f
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Wed Feb 3 00:28:30 2016 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Tue Mar 8 22:52:34 2016 +1300
Print error message before panicking on missing error-hook
We always have a message on hand and there's no harm in printing it
before exiting.
diff --git a/runtime.c b/runtime.c
index 0149b4d3..6fd1cb78 100644
--- a/runtime.c
+++ b/runtime.c
@@ -1684,9 +1684,6 @@ void barf(int code, char *loc, ...)
C_temporary_stack = C_temporary_stack_bottom;
err = C_block_item(err, 0);
- if(C_immediatep(err))
- panic(C_text("`##sys#error-hook' is not defined - the `library' unit was probably not linked with this executable"));
-
switch(code) {
case C_BAD_ARGUMENT_COUNT_ERROR:
msg = C_text("bad argument count");
@@ -1961,9 +1958,11 @@ void barf(int code, char *loc, ...)
default: panic(C_text("illegal internal error code"));
}
- av = C_alloc(c + 4);
-
- if(!C_immediatep(err)) {
+ if(C_immediatep(err)) {
+ C_dbg(C_text("error"), C_text("%s\n"), msg);
+ panic(C_text("`##sys#error-hook' is not defined - the `library' unit was probably not linked with this executable"));
+ } else {
+ av = C_alloc(c + 4);
va_start(v, loc);
av[ 0 ] = err;
/* No continuation is passed: '##sys#error-hook' may not return: */
@@ -1983,7 +1982,6 @@ void barf(int code, char *loc, ...)
va_end(v);
C_do_apply(c + 4, av);
}
- else panic(msg);
}
Trap