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,9 +23,8 @@ module ExecJS
|
|||
|
||||
if /\S/ =~ source
|
||||
lock do
|
||||
begin
|
||||
unbox @v8_context.eval("(#{source})")
|
||||
end
|
||||
end
|
||||
rescue ::V8::JSError => e
|
||||
if e.value["name"] == "SyntaxError"
|
||||
raise RuntimeError, e.message
|
||||
|
@ -33,11 +32,14 @@ module ExecJS
|
|||
raise ProgramError, e.message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def call(properties, *args)
|
||||
lock do
|
||||
begin
|
||||
unbox @v8_context.eval(properties).call(*args)
|
||||
end
|
||||
rescue ::V8::JSError => e
|
||||
if e.value["name"] == "SyntaxError"
|
||||
raise RuntimeError, e.message
|
||||
|
@ -45,6 +47,8 @@ module ExecJS
|
|||
raise ProgramError, e.message
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def unbox(value)
|
||||
case value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue