Skip to content

Instantly share code, notes, and snippets.

@TonyStrauss
Created January 31, 2012 17:32
Show Gist options
  • Save TonyStrauss/1711740 to your computer and use it in GitHub Desktop.
Save TonyStrauss/1711740 to your computer and use it in GitHub Desktop.
require 'v8'
JS = <<EOF
Foo = function() {
throw new Error("BOOG1");
};
function bar() {
throw new Error("BOOG2");
}
EOF
js_context = V8::Context.new
js_context.eval JS
begin
js_context['Foo'].new
$stderr.puts "Failed to propagate exception from js constructor!"
rescue Exception => e
$stderr.puts "Correctly propagated exception from js constructor!"
end
begin
js_context['bar'].call
$stderr.puts "Failed to propagate exception from function!"
rescue Exception => e
$stderr.puts "Correctly propagated exception from function!"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment