mirror of https://github.com/lukechilds/node.git
Browse Source
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>v6.x
committed by
Jeremiah Senkpiel
5 changed files with 45 additions and 15 deletions
@ -0,0 +1,18 @@ |
|||||
|
'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'); |
@ -0,0 +1,3 @@ |
|||||
|
beginning |
||||
|
received error MyCustomError |
||||
|
end |
Loading…
Reference in new issue