Created
January 31, 2012 17:32
-
-
Save TonyStrauss/1711740 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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