mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-02 13:00:26 +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
|
@ -566,8 +566,28 @@ pre_init_throw (SCM k, SCM args)
|
|||
return scm_at_abort (sym_pre_init_catch_tag, scm_cons (k, args));
|
||||
else
|
||||
{
|
||||
fprintf (stderr, "Throw without catch before boot:\n");
|
||||
scm_handle_by_message_noexit (NULL, k, args);
|
||||
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
|
||||
{
|
||||
fprintf (stderr, "Throw without catch before boot:\n");
|
||||
error_printing_error = 1;
|
||||
scm_handle_by_message_noexit (NULL, k, args);
|
||||
}
|
||||
|
||||
fprintf (stderr, "Aborting.\n");
|
||||
abort ();
|
||||
return SCM_BOOL_F; /* not reached */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue