# b.rb
require 'v8'
context = V8::Context.new
Fiber.new do
context.enter do
V8::C::TryCatch() do |trycatch|
script = V8::C::Script::New("console.log('hi')", '<b>')
if trycatch.HasCaught()
puts "HasCaught!"
p trycatch.Exception.Get("message").to_ruby
end
end
end
end.resume
The output for a.rb:
a.rb:6:in `block in <main>': Maximum call stack size exceeded (V8::Error)
The output for b.rb:
HasCaught!
"Maximum call stack size exceeded"
The error occurs only on Linux; macOS works as expected.
Replacing Fiber.new do X end.resume with X makes the examples work as expected.
The following examples raise a “Maximum call stack size exceeded” error:
The output for
a.rb
:The output for
b.rb
:The error occurs only on Linux; macOS works as expected.
Replacing
Fiber.new do X end.resume
withX
makes the examples work as expected.