diff options
author | Marius Vollmer <mvo@zagadka.de> | 2004-09-23 17:48:25 +0000 |
---|---|---|
committer | Marius Vollmer <mvo@zagadka.de> | 2004-09-23 17:48:25 +0000 |
commit | cdd8c0912872cd94867bbfaf681661681343cb10 (patch) | |
tree | 694f1459c423aefbde98ca811b0ac8cd2dbb518d /libguile/error.c | |
parent | d232520a23677ac22435e6c3144e8634376cb295 (diff) | |
download | guile-cdd8c0912872cd94867bbfaf681661681343cb10.tar.gz |
(scm_error_scm): Document new meaning of data/rest
argument for out-of-range and wrong-type-arg errors.
(scm_out_of_range, scm_out_of_range_pos, scm_wrong_type_arg,
scm_wrong_type_arg_msg): Pass bad_value in rest argument of
exception so that it gets highlighted in the backtrace.
Don't talk about "argument" when not giving a position.
Diffstat (limited to 'libguile/error.c')
-rw-r--r-- | libguile/error.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libguile/error.c b/libguile/error.c index ef364b707..e202844f6 100644 --- a/libguile/error.c +++ b/libguile/error.c @@ -77,7 +77,9 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0, "@code{#f} depending on @var{key}: if @var{key} is\n" "@code{system-error} then it should be a list containing the\n" "Unix @code{errno} value; If @var{key} is @code{signal} then it\n" - "should be a list containing the Unix signal number; otherwise\n" + "should be a list containing the Unix signal number; If\n" + "@var{key} is @code{out-of-range} or @code{wrong-type-arg},\n" + "it is a list containing the bad value; otherwise\n" "it will usually be @code{#f}.") #define FUNC_NAME s_scm_error_scm { @@ -181,9 +183,9 @@ scm_out_of_range (const char *subr, SCM bad_value) { scm_error (scm_out_of_range_key, subr, - "Argument out of range: ~S", + "Value out of range: ~S", scm_list_1 (bad_value), - SCM_BOOL_F); + scm_list_1 (bad_value)); } void @@ -191,9 +193,9 @@ scm_out_of_range_pos (const char *subr, SCM bad_value, SCM pos) { scm_error (scm_out_of_range_key, subr, - "Argument ~S out of range: ~S", + "Argument ~A out of range: ~S", scm_list_2 (pos, bad_value), - SCM_BOOL_F); + scm_list_1 (bad_value)); } @@ -230,25 +232,28 @@ scm_wrong_type_arg (const char *subr, int pos, SCM bad_value) : "Wrong type argument in position ~A: ~S", (pos == 0) ? scm_list_1 (bad_value) : scm_list_2 (scm_from_int (pos), bad_value), - SCM_BOOL_F); + scm_list_1 (bad_value)); } void scm_wrong_type_arg_msg (const char *subr, int pos, SCM bad_value, const char *szMessage) { SCM msg = scm_from_locale_string (szMessage); - if (pos == 0) { - scm_error (scm_arg_type_key, - subr, "Wrong type argument (expecting ~A): ~S", - scm_list_2 (msg, bad_value), - SCM_BOOL_F); - } else { - scm_error (scm_arg_type_key, - subr, - "Wrong type argument in position ~A (expecting ~A): ~S", - scm_list_3 (scm_from_int (pos), msg, bad_value), - SCM_BOOL_F); - } + if (pos == 0) + { + scm_error (scm_arg_type_key, + subr, "Wrong type (expecting ~A): ~S", + scm_list_2 (msg, bad_value), + scm_list_1 (bad_value)); + } + else + { + scm_error (scm_arg_type_key, + subr, + "Wrong type argument in position ~A (expecting ~A): ~S", + scm_list_3 (scm_from_int (pos), msg, bad_value), + scm_list_1 (bad_value)); + } } |