summaryrefslogtreecommitdiff
path: root/libguile/error.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/error.c')
-rw-r--r--libguile/error.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/libguile/error.c b/libguile/error.c
index 3facf167d..cab5c0d28 100644
--- a/libguile/error.c
+++ b/libguile/error.c
@@ -124,7 +124,7 @@ scm_perror (arg)
void (*scm_error_callback) () = 0;
-/* all errors thrown from C should pass through here. */
+/* All errors should pass through here. */
void
scm_error (key, subr, message, args, rest)
SCM key;
@@ -150,6 +150,31 @@ scm_error (key, subr, message, args, rest)
exit (1);
}
+/* Scheme interface to scm_error. */
+SCM_PROC(s_error_scm, "scm-error", 5, 0, 0, scm_error_scm);
+SCM
+scm_error_scm (key, subr, message, args, rest)
+ SCM key;
+ SCM subr;
+ SCM message;
+ SCM args;
+ SCM rest;
+{
+ SCM_ASSERT (SCM_NIMP (key) && SCM_SYMBOLP (key), key, SCM_ARG1, s_error_scm);
+ SCM_ASSERT (SCM_FALSEP (subr) || (SCM_NIMP (subr) && SCM_ROSTRINGP (subr)),
+ subr, SCM_ARG2, s_error_scm);
+ SCM_ASSERT (SCM_FALSEP (message)
+ || (SCM_NIMP (message) && SCM_ROSTRINGP (message)),
+ message, SCM_ARG3, s_error_scm);
+
+ scm_error (key,
+ (SCM_FALSEP (subr)) ? NULL : SCM_ROCHARS (subr),
+ (SCM_FALSEP (message)) ? NULL : SCM_ROCHARS (message),
+ args,
+ rest);
+ /* not reached. */
+}
+
SCM_SYMBOL (scm_system_error_key, "system-error");
void
scm_syserror (subr)