lib/v8/function.rb in therubyracer-0.7.4 vs lib/v8/function.rb in therubyracer-0.7.5
- old
+ new
@@ -23,21 +23,33 @@
@context.enter do
To.rb(@native.NewInstance(To.v8(args)))
end
end
- def self.rubycall(rubycode, *args)
+ def self.rubyprotect
begin
- To.v8(rubycode.call(*args))
+ To.v8(yield)
rescue Exception => e
case e
when SystemExit, NoMemoryError
raise e
else
error = V8::C::Exception::Error(V8::C::String::New(e.message))
error.SetHiddenValue("TheRubyRacer::Cause", C::External::New(e))
V8::C::ThrowException(error)
end
+ end
+ end
+
+ def self.rubycall(rubycode, *args)
+ rubyprotect do
+ rubycode.call(*args)
+ end
+ end
+
+ def self.rubysend(obj, message, *args)
+ rubyprotect do
+ obj.send(message, *args)
end
end
end
end
\ No newline at end of file