mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-07 07:25:49 +02:00
Add exception handling to rubyArgs.
This commit is contained in:
parent
63b92d3815
commit
a08fea1574
1 changed files with 18 additions and 1 deletions
|
@ -802,7 +802,24 @@ static void mriBindingExecute() {
|
||||||
void *node = ruby_process_options(rubyArgsC.size(), const_cast<char**>(rubyArgsC.data()));
|
void *node = ruby_process_options(rubyArgsC.size(), const_cast<char**>(rubyArgsC.data()));
|
||||||
int state;
|
int state;
|
||||||
bool valid = ruby_executable_node(node, &state);
|
bool valid = ruby_executable_node(node, &state);
|
||||||
state = ruby_exec_node(node);
|
if (valid)
|
||||||
|
state = ruby_exec_node(node);
|
||||||
|
if (state || !valid) {
|
||||||
|
#if RAPI_FULL > 187
|
||||||
|
VALUE exc = rb_errinfo();
|
||||||
|
#else
|
||||||
|
VALUE exc = rb_gv_get("$!");
|
||||||
|
#endif
|
||||||
|
#if RAPI_FULL >= 250
|
||||||
|
VALUE msg = rb_funcall(exc, rb_intern("full_message"), 0);
|
||||||
|
#else
|
||||||
|
VALUE msg = rb_funcall(exc, rb_intern("message"), 0);
|
||||||
|
#endif
|
||||||
|
showMsg(std::string("An argument passed to Ruby via 'rubyArg' is invalid:\n") + StringValueCStr(msg));
|
||||||
|
ruby_cleanup(state);
|
||||||
|
shState->rtData().rqTermAck.set();
|
||||||
|
return;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
ruby_init();
|
ruby_init();
|
||||||
rb_eval_string("$KCODE='U'");
|
rb_eval_string("$KCODE='U'");
|
||||||
|
|
Loading…
Add table
Reference in a new issue