Skip to content

Commit

Permalink
Remove extra begin/end for #translate
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Oct 1, 2021
1 parent 13d3c5d commit c6f4f6e
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions lib/execjs/graaljs_runtime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,16 @@ def call(source, *args)
private

def translate
begin
convert_js_to_ruby yield
rescue ::RuntimeError => e
if e.message.start_with?('SyntaxError:')
error_class = ExecJS::RuntimeError
else
error_class = ExecJS::ProgramError
end

backtrace = e.backtrace.map { |line| line.sub('(eval)', '(execjs)') }
raise error_class, e.message, backtrace
convert_js_to_ruby yield
rescue ::RuntimeError => e
if e.message.start_with?('SyntaxError:')
error_class = ExecJS::RuntimeError
else
error_class = ExecJS::ProgramError
end

backtrace = e.backtrace.map { |line| line.sub('(eval)', '(execjs)') }
raise error_class, e.message, backtrace
end

def convert_js_to_ruby(value)
Expand Down

0 comments on commit c6f4f6e

Please sign in to comment.