diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-07-12 21:29:46 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2014-07-12 21:29:46 +0900 |
| commit | 4501598f27b3733d02210be43c4a05a0f081ff62 (patch) | |
| tree | 0099346f637cb576701186d23cf7f5a6c17db1d3 | |
| parent | 4a6c651f82c2d416682e9729842d4fda6beee2bf (diff) | |
| download | mruby-4501598f27b3733d02210be43c4a05a0f081ff62.tar.gz mruby-4501598f27b3733d02210be43c4a05a0f081ff62.zip | |
use SystemStackError instead of RuntimeError
| -rw-r--r-- | include/mruby.h | 1 | ||||
| -rw-r--r-- | src/error.c | 1 | ||||
| -rw-r--r-- | src/vm.c | 2 |
3 files changed, 3 insertions, 1 deletions
diff --git a/include/mruby.h b/include/mruby.h index d91e024d1..5c99052c1 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -385,6 +385,7 @@ void mrb_print_error(mrb_state *mrb); #define E_SYNTAX_ERROR (mrb_class_get(mrb, "SyntaxError")) #define E_LOCALJUMP_ERROR (mrb_class_get(mrb, "LocalJumpError")) #define E_REGEXP_ERROR (mrb_class_get(mrb, "RegexpError")) +#define E_SYSSTACK_ERROR (mrb_class_get(mrb, "SystemStackError")) #define E_NOTIMP_ERROR (mrb_class_get(mrb, "NotImplementedError")) #define E_FLOATDOMAIN_ERROR (mrb_class_get(mrb, "FloatDomainError")) diff --git a/src/error.c b/src/error.c index dcb6063f8..d472f7f95 100644 --- a/src/error.c +++ b/src/error.c @@ -455,4 +455,5 @@ mrb_init_exception(mrb_state *mrb) mrb->nomem_err = mrb_obj_ptr(mrb_exc_new_str(mrb, runtime_error, mrb_str_new_lit(mrb, "Out of memory"))); script_error = mrb_define_class(mrb, "ScriptError", mrb->eException_class); /* 15.2.37 */ mrb_define_class(mrb, "SyntaxError", script_error); /* 15.2.38 */ + mrb_define_class(mrb, "SystemStackError", exception); } @@ -160,7 +160,7 @@ stack_extend_alloc(mrb_state *mrb, int room, int keep) to prevent infinite recursion. However, do this only after resizing the stack, so mrb_raise has stack space to work with. */ if (size > MRB_STACK_MAX) { init_new_stack_space(mrb, room, keep); - mrb_raise(mrb, E_RUNTIME_ERROR, "stack level too deep. (limit=" TO_STR(MRB_STACK_MAX) ")"); + mrb_raise(mrb, E_SYSSTACK_ERROR, "stack level too deep. (limit=" TO_STR(MRB_STACK_MAX) ")"); } } |
