1
0
Fork 0
mirror of https://github.com/rails/execjs synced 2023-03-27 23:21:20 -04:00

Fix the ruby racer lock exception catching

This commit is contained in:
Joshua Peek 2011-06-13 16:25:12 -05:00
parent b67a563ab4
commit 066a4c52f0

View file

@ -23,26 +23,30 @@ module ExecJS
if /\S/ =~ source
lock do
unbox @v8_context.eval("(#{source})")
begin
unbox @v8_context.eval("(#{source})")
rescue ::V8::JSError => e
if e.value["name"] == "SyntaxError"
raise RuntimeError, e.message
else
raise ProgramError, e.message
end
end
end
end
rescue ::V8::JSError => e
if e.value["name"] == "SyntaxError"
raise RuntimeError, e.message
else
raise ProgramError, e.message
end
end
def call(properties, *args)
lock do
unbox @v8_context.eval(properties).call(*args)
end
rescue ::V8::JSError => e
if e.value["name"] == "SyntaxError"
raise RuntimeError, e.message
else
raise ProgramError, e.message
begin
unbox @v8_context.eval(properties).call(*args)
rescue ::V8::JSError => e
if e.value["name"] == "SyntaxError"
raise RuntimeError, e.message
else
raise ProgramError, e.message
end
end
end
end