mirror of
https://github.com/nodejs/node.git
synced 2025-05-19 20:06:58 +00:00

Keep track of C++ `TryCatch` state to avoid aborting when an exception is thrown inside one, and re-throw in JS to make sure the exception is being picked up a second time by a second uncaught exception handler, if necessary. Add a bit of a hack to `AppendExceptionLine` to avoid overriding the line responsible for re-throwing the exception. PR-URL: https://github.com/nodejs/node/pull/17394 Fixes: https://github.com/nodejs/node/issues/13258 Reviewed-By: James M Snell <jasnell@gmail.com>
15 lines
309 B
JavaScript
15 lines
309 B
JavaScript
// Flags: --abort-on-uncaught-exception
|
|
'use strict';
|
|
require('../common');
|
|
const vm = require('vm');
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/13258
|
|
|
|
try {
|
|
new vm.Script({ toString() { throw new Error('foo'); } }, {});
|
|
} catch (err) {}
|
|
|
|
try {
|
|
new vm.Script('[', {});
|
|
} catch (err) {}
|