mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Include the source location in error messages for scripts.
* init.c (scm_boot_guile_1): Use scm_internal_lazy_catch, so the stack is still there when we catch the error. * throw.c (handler_message): If we are handling an error with a message, then put together the proper arguments and call scm_display_error, instead of scm_display_error_message. That displays source location, if it can find it.
This commit is contained in:
parent
a8e0500932
commit
f64056d105
2 changed files with 13 additions and 10 deletions
|
@ -509,7 +509,7 @@ scm_boot_guile_1 (base, closure)
|
|||
if (!setjmp_val)
|
||||
{
|
||||
scm_set_program_arguments (closure->argc, closure->argv, 0);
|
||||
scm_internal_catch (SCM_BOOL_T, invoke_main_func, closure,
|
||||
scm_internal_lazy_catch (SCM_BOOL_T, invoke_main_func, closure,
|
||||
scm_handle_by_message, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -476,21 +476,24 @@ handler_message (void *handler_data, SCM tag, SCM args)
|
|||
char *prog_name = (char *) handler_data;
|
||||
SCM p = scm_cur_errp;
|
||||
|
||||
if (scm_ilength (args) >= 3)
|
||||
{
|
||||
SCM stack = scm_make_stack (SCM_LIST1 (SCM_BOOL_T));
|
||||
SCM subr = SCM_CAR (args);
|
||||
SCM message = SCM_CADR (args);
|
||||
SCM parts = SCM_CADDR (args);
|
||||
SCM rest = SCM_CDDDR (args);
|
||||
|
||||
scm_display_error (stack, p, subr, message, parts, rest);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (! prog_name)
|
||||
prog_name = "guile";
|
||||
|
||||
scm_puts (prog_name, p);
|
||||
scm_puts (": ", p);
|
||||
|
||||
if (scm_ilength (args) >= 3)
|
||||
{
|
||||
SCM message = SCM_CADR (args);
|
||||
SCM parts = SCM_CADDR (args);
|
||||
|
||||
scm_display_error_message (message, parts, p);
|
||||
}
|
||||
else
|
||||
{
|
||||
scm_puts ("uncaught throw to ", p);
|
||||
scm_prin1 (tag, p, 0);
|
||||
scm_puts (": ", p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue