diff --git a/ext/v8/v8.cpp b/ext/v8/v8.cpp index 612dee71..6c50971e 100644 --- a/ext/v8/v8.cpp +++ b/ext/v8/v8.cpp @@ -65,6 +65,8 @@ extern "C" { rb_define_method(V8_C_Object, "Set", (VALUE(*)(...))v8_Object_Set, 2); V8_C_Message = rb_define_class_under(rb_mNative, "Message", rb_cObject); + rb_define_method(V8_C_Message, "Get", (VALUE(*)(...))v8_Message_Get, 0); + V8_C_Function = rb_define_class_under(rb_mNative, "Function", V8_C_Object); } } diff --git a/ext/v8/v8_cxt.cpp b/ext/v8/v8_cxt.cpp index 694743e1..bb6e4583 100644 --- a/ext/v8/v8_cxt.cpp +++ b/ext/v8/v8_cxt.cpp @@ -25,17 +25,10 @@ VALUE v8_cxt_Global(VALUE self) { VALUE v8_cxt_open(VALUE self) { HandleScope handles; - TryCatch exceptions; Local cxt = V8_Ref_Get(self); Context::Scope enter(cxt); if (rb_block_given_p()) { - VALUE result = rb_yield(self); - if (exceptions.HasCaught()) { - return V8_Wrap_Message(exceptions.Message()); - } else { - return result; - } - return result; + return rb_yield(self); } else { return Qnil; } @@ -43,12 +36,17 @@ VALUE v8_cxt_open(VALUE self) { VALUE v8_cxt_eval(VALUE self, VALUE source) { HandleScope handles; + TryCatch exceptions; Local cxt = V8_Ref_Get(self); Context::Scope enter(cxt); Local source_str = RB2V8(source); Local