summaryrefslogtreecommitdiff
path: root/test/fixtures/uncaught-exceptions
diff options
context:
space:
mode:
authorMiroslav Bajtos <miro.bajtos@gmail.com>2013-06-17 21:19:59 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2013-06-26 19:54:31 +0200
commitc16963b977b3cede4cef476c275226a513831407 (patch)
treeb3bd1918ddd393991e3933b88d3b79674dc99daf /test/fixtures/uncaught-exceptions
parent4bc024ddecf4e0daaa5d28155d3ad5977b98a68e (diff)
downloadandroid-node-v8-c16963b977b3cede4cef476c275226a513831407.tar.gz
android-node-v8-c16963b977b3cede4cef476c275226a513831407.tar.bz2
android-node-v8-c16963b977b3cede4cef476c275226a513831407.zip
src: break on uncaught exception
Most TryCatch blocks have SetVerbose flag on, this tells V8 to report uncaught exceptions to debugger. FatalException handler is called from V8 Message listener instead from the place where TryCatch was used. Otherwise uncaught exceptions are logged twice. See comment in `deps/v8/include/v8.h` for explanation of SetVerbose flag: > By default, exceptions that are caught by an external exception > handler are not reported. Call SetVerbose with true on an > external exception handler to have exceptions caught by the > handler reported as if they were not caught. The flag is used by `Isolate::ShouldReportException()`, which is called by `Isolate::DoThrow()` to decide whether an exception is considered uncaught.
Diffstat (limited to 'test/fixtures/uncaught-exceptions')
-rw-r--r--test/fixtures/uncaught-exceptions/domain.js12
-rw-r--r--test/fixtures/uncaught-exceptions/global.js2
-rw-r--r--test/fixtures/uncaught-exceptions/parse-error-mod.js2
-rw-r--r--test/fixtures/uncaught-exceptions/parse-error.js2
-rw-r--r--test/fixtures/uncaught-exceptions/timeout.js3
5 files changed, 21 insertions, 0 deletions
diff --git a/test/fixtures/uncaught-exceptions/domain.js b/test/fixtures/uncaught-exceptions/domain.js
new file mode 100644
index 0000000000..c00b22dbb9
--- /dev/null
+++ b/test/fixtures/uncaught-exceptions/domain.js
@@ -0,0 +1,12 @@
+var domain = require('domain');
+
+var d = domain.create();
+d.on('error', function(err) {
+ console.log('[ignored]', err.stack);
+});
+
+d.run(function() {
+ setImmediate(function() {
+ throw new Error('in domain');
+ });
+});
diff --git a/test/fixtures/uncaught-exceptions/global.js b/test/fixtures/uncaught-exceptions/global.js
new file mode 100644
index 0000000000..df14e88c47
--- /dev/null
+++ b/test/fixtures/uncaught-exceptions/global.js
@@ -0,0 +1,2 @@
+console.log('going to throw an error');
+throw new Error('global');
diff --git a/test/fixtures/uncaught-exceptions/parse-error-mod.js b/test/fixtures/uncaught-exceptions/parse-error-mod.js
new file mode 100644
index 0000000000..05dbf29f00
--- /dev/null
+++ b/test/fixtures/uncaught-exceptions/parse-error-mod.js
@@ -0,0 +1,2 @@
+console.log('parse error on next line');
+var a = ';
diff --git a/test/fixtures/uncaught-exceptions/parse-error.js b/test/fixtures/uncaught-exceptions/parse-error.js
new file mode 100644
index 0000000000..8ec4d4ec85
--- /dev/null
+++ b/test/fixtures/uncaught-exceptions/parse-error.js
@@ -0,0 +1,2 @@
+console.log('require fails on next line');
+require('./parse-error-mod.js');
diff --git a/test/fixtures/uncaught-exceptions/timeout.js b/test/fixtures/uncaught-exceptions/timeout.js
new file mode 100644
index 0000000000..1d8491ff62
--- /dev/null
+++ b/test/fixtures/uncaught-exceptions/timeout.js
@@ -0,0 +1,3 @@
+setTimeout(function() {
+ throw new Error('timeout');
+}, 10);