mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
57003520f8
The vm module's displayErrors option attaches error arrow messages as a hidden property. Later, core JavaScript code can optionally decorate the error stack with the arrow message. However, when user code catches an error, it has no way to access the arrow message. This commit changes the behavior of displayErrors to mean "decorate the error stack if an error occurs." Fixes: https://github.com/nodejs/node/issues/4835 PR-URL: https://github.com/nodejs/node/pull/4874 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
16 lines
300 B
JavaScript
16 lines
300 B
JavaScript
'use strict';
|
|
require('../common');
|
|
var vm = require('vm');
|
|
|
|
console.error('beginning');
|
|
|
|
try {
|
|
vm.runInThisContext('var 4;', { filename: 'foo.vm', displayErrors: true });
|
|
} catch (err) {
|
|
console.error(err.stack);
|
|
}
|
|
|
|
vm.runInThisContext('var 5;', { filename: 'test.vm' });
|
|
|
|
console.error('end');
|