mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 07:00:59 +01:00
3cac616791
In `AppendExceptionLine()`, which is used both by the `vm` module and the uncaught exception handler, don’t print anything to stderr when called from the `vm` module, even if the thrown object is not a native error instance. Fixes: https://github.com/nodejs/node/issues/7397 PR-URL: https://github.com/nodejs/node/pull/7398 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
19 lines
455 B
JavaScript
19 lines
455 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const vm = require('vm');
|
|
|
|
console.error('beginning');
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/7397:
|
|
// vm.runInThisContext() should not print out anything to stderr by itself.
|
|
try {
|
|
vm.runInThisContext(`throw ({
|
|
name: 'MyCustomError',
|
|
message: 'This is a custom message'
|
|
})`, { filename: 'test.vm' });
|
|
} catch (e) {
|
|
console.error('received error', e.name);
|
|
}
|
|
|
|
console.error('end');
|