lib/v8/function.rb in therubyracer-0.7.1 vs lib/v8/function.rb in therubyracer-0.7.2.pre

- old
+ new

@@ -5,12 +5,12 @@ err = nil return_value = nil C::TryCatch.try do |try| @context.enter do this = To.v8(thisObject) - return_value = To.ruby(@native.Call(this, To.v8(args))) - err = JavascriptError.new(try) if try.HasCaught() + return_value = To.rb(@native.Call(this, To.v8(args))) + err = JSError.new(try) if try.HasCaught() end end raise err if err return return_value end @@ -26,12 +26,13 @@ end def self.rubycall(rubycode, *args) begin To.v8(rubycode.call(*args)) - rescue StandardError => e - V8::C::ThrowException(V8::C::Exception::Error(V8::C::String::New(e.message))) + rescue Exception => e + 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 end \ No newline at end of file