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:
parent
b67a563ab4
commit
066a4c52f0
1 changed files with 18 additions and 14 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue