diff options
author | cjihrig <cjihrig@gmail.com> | 2016-01-25 22:44:17 -0500 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2016-01-26 11:03:13 -0500 |
commit | 57003520f83a9431dbef0dfce2edacf430923f20 (patch) | |
tree | 41b8a702f6fb5b30883375261756d237223e6e5b /test/message/vm_display_syntax_error.js | |
parent | d66f18e6cde8cadf20e3c4ddc85ec495546d1fb4 (diff) | |
download | android-node-v8-57003520f83a9431dbef0dfce2edacf430923f20.tar.gz android-node-v8-57003520f83a9431dbef0dfce2edacf430923f20.tar.bz2 android-node-v8-57003520f83a9431dbef0dfce2edacf430923f20.zip |
src: attach error to stack on displayErrors
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>
Diffstat (limited to 'test/message/vm_display_syntax_error.js')
-rw-r--r-- | test/message/vm_display_syntax_error.js | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/message/vm_display_syntax_error.js b/test/message/vm_display_syntax_error.js index 23525c14d8..62bbd432a2 100644 --- a/test/message/vm_display_syntax_error.js +++ b/test/message/vm_display_syntax_error.js @@ -4,6 +4,12 @@ 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'); |