mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-03 21:30:29 +02:00
more robust fallback error printer
* libguile/throw.c (pre_init_throw): Deal with errors printing the exception.
This commit is contained in:
parent
eaf2d3f253
commit
cd4f274c62
1 changed files with 22 additions and 2 deletions
|
@ -564,10 +564,30 @@ pre_init_throw (SCM k, SCM args)
|
||||||
{
|
{
|
||||||
if (find_pre_init_catch ())
|
if (find_pre_init_catch ())
|
||||||
return scm_at_abort (sym_pre_init_catch_tag, scm_cons (k, args));
|
return scm_at_abort (sym_pre_init_catch_tag, scm_cons (k, args));
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static int error_printing_error = 0;
|
||||||
|
static int error_printing_fallback = 0;
|
||||||
|
|
||||||
|
if (error_printing_fallback)
|
||||||
|
fprintf (stderr, "\nFailed to print exception.\n");
|
||||||
|
else if (error_printing_error)
|
||||||
|
{
|
||||||
|
fprintf (stderr, "\nError while printing exception:\n");
|
||||||
|
error_printing_fallback = 1;
|
||||||
|
fprintf (stderr, "Key: ");
|
||||||
|
scm_write (k, scm_current_error_port ());
|
||||||
|
fprintf (stderr, ", args: ");
|
||||||
|
scm_write (args, scm_current_error_port ());
|
||||||
|
scm_newline (scm_current_error_port ());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Throw without catch before boot:\n");
|
fprintf (stderr, "Throw without catch before boot:\n");
|
||||||
|
error_printing_error = 1;
|
||||||
scm_handle_by_message_noexit (NULL, k, args);
|
scm_handle_by_message_noexit (NULL, k, args);
|
||||||
|
}
|
||||||
|
|
||||||
fprintf (stderr, "Aborting.\n");
|
fprintf (stderr, "Aborting.\n");
|
||||||
abort ();
|
abort ();
|
||||||
return SCM_BOOL_F; /* not reached */
|
return SCM_BOOL_F; /* not reached */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue