add make-error-object procedure

This commit is contained in:
Yuichi Nishiwaki 2014-09-17 00:43:12 +09:00
parent 061ddb58ee
commit 854f83a247
1 changed files with 17 additions and 0 deletions

17
error.c
View File

@ -219,6 +219,22 @@ pic_error_error(pic_state *pic)
pic_error(pic, str, pic_list_by_array(pic, argc, argv)); pic_error(pic, str, pic_list_by_array(pic, argc, argv));
} }
static pic_value
pic_error_make_error_object(pic_state *pic)
{
struct pic_error *e;
pic_sym type;
pic_str *msg;
size_t argc;
pic_value *argv;
pic_get_args(pic, "ms*", &type, &msg, &argc, &argv);
e = pic_make_error(pic, type, pic_str_cstr(msg), pic_list_by_array(pic, argc, argv));
return pic_obj_value(e);
}
static pic_value static pic_value
pic_error_error_object_p(pic_state *pic) pic_error_error_object_p(pic_state *pic)
{ {
@ -290,6 +306,7 @@ pic_init_error(pic_state *pic)
pic_defun(pic, "raise", pic_error_raise); pic_defun(pic, "raise", pic_error_raise);
pic_defun(pic, "raise-continuable", pic_error_raise_continuable); pic_defun(pic, "raise-continuable", pic_error_raise_continuable);
pic_defun(pic, "error", pic_error_error); pic_defun(pic, "error", pic_error_error);
pic_defun(pic, "make-error-object", pic_error_make_error_object);
pic_defun(pic, "error-object?", pic_error_error_object_p); pic_defun(pic, "error-object?", pic_error_error_object_p);
pic_defun(pic, "error-object-message", pic_error_error_object_message); pic_defun(pic, "error-object-message", pic_error_error_object_message);
pic_defun(pic, "error-object-irritants", pic_error_error_object_irritants); pic_defun(pic, "error-object-irritants", pic_error_error_object_irritants);