summaryrefslogtreecommitdiff
path: root/libguile/throw.c
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@lilypond.org>2007-01-10 11:42:04 +0000
committerHan-Wen Nienhuys <hanwen@lilypond.org>2007-01-10 11:42:04 +0000
commita2c40dc7c0c52eaf6a58660a7c44665fdebba252 (patch)
tree66bdc814b4b315ca848b95e02f4645d693055cfb /libguile/throw.c
parent391f57e6ad53a2855b4f3ab270edd328da275dfd (diff)
downloadguile-a2c40dc7c0c52eaf6a58660a7c44665fdebba252.tar.gz
(scm_ithrow): print out key symbol and string arguments
when error happens inside a critical section, and document why.
Diffstat (limited to 'libguile/throw.c')
-rw-r--r--libguile/throw.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libguile/throw.c b/libguile/throw.c
index 115bb0c03..86e4d1fa7 100644
--- a/libguile/throw.c
+++ b/libguile/throw.c
@@ -37,6 +37,7 @@
#include "libguile/validate.h"
#include "libguile/throw.h"
#include "libguile/init.h"
+#include "libguile/strings.h"
/* the jump buffer data structure */
@@ -695,7 +696,24 @@ scm_ithrow (SCM key, SCM args, int noreturn SCM_UNUSED)
if (scm_i_critical_section_level)
{
+ SCM s = args;
+ int i = 0;
+
+ /*
+ We have much better routines for displaying Scheme, but we're
+ already inside a pernicious error, and it's unlikely that they
+ are available to us. We try to print something useful anyway,
+ so users don't need a debugger to find out what went wrong.
+ */
fprintf (stderr, "throw from within critical section.\n");
+ if (scm_is_symbol (key))
+ fprintf (stderr, "error key: %s\n", scm_i_symbol_chars (key));
+
+
+ for (; scm_is_pair (s); s = scm_cdr (s), i++)
+ if (scm_is_string (scm_car (s)))
+ fprintf (stderr, "argument %d: %s\n", i, scm_i_string_chars (scm_car (s)));
+
abort ();
}