mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
15 lines
No EOL
281 B
Ruby
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 |