1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/lib/v8/error/try.rb
2012-06-14 22:34:38 -05:00

15 lines
No EOL
281 B
Ruby

class V8::Error
module Try
def try
context = V8::Context.current
V8::C::TryCatch() do |trycatch|
result = yield
if trycatch.HasCaught()
V8::Error(trycatch.Exception())
else
result
end
end
end
end
end