diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-11-20 19:57:20 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-11-29 15:58:42 +0100 |
commit | 4503da8a3a3b0b71d950a63de729ce495965f6ea (patch) | |
tree | 66ad243cd90cea3df8fc11eb7cf29597ddd56eb3 /test/parallel/test-process-exception-capture-should-abort-on-uncaught.js | |
parent | 04e3aa28bbcdf62f677dd314ad8c12556c18c15f (diff) | |
download | android-node-v8-4503da8a3a3b0b71d950a63de729ce495965f6ea.tar.gz android-node-v8-4503da8a3a3b0b71d950a63de729ce495965f6ea.tar.bz2 android-node-v8-4503da8a3a3b0b71d950a63de729ce495965f6ea.zip |
process: add flag for uncaught exception abort
Introduce `process.shouldAbortOnUncaughtException` to control
`--abort-on-uncaught-exception` behaviour, and implement
some of the domains functionality on top of it.
PR-URL: https://github.com/nodejs/node/pull/17159
Refs: https://github.com/nodejs/node/issues/17143
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Diffstat (limited to 'test/parallel/test-process-exception-capture-should-abort-on-uncaught.js')
-rw-r--r-- | test/parallel/test-process-exception-capture-should-abort-on-uncaught.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js new file mode 100644 index 0000000000..f9e685a86e --- /dev/null +++ b/test/parallel/test-process-exception-capture-should-abort-on-uncaught.js @@ -0,0 +1,12 @@ +// Flags: --abort-on-uncaught-exception +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +assert.strictEqual(process.hasUncaughtExceptionCaptureCallback(), false); + +// This should make the process not crash even though the flag was passed. +process.setUncaughtExceptionCaptureCallback(common.mustCall((err) => { + assert.strictEqual(err.message, 'foo'); +})); +throw new Error('foo'); |