aboutsummaryrefslogtreecommitdiff
path: root/test/message/events_unhandled_error_common_trace.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-02-26 15:46:50 +0100
committerAnna Henningsen <anna@addaleax.net>2018-03-04 21:20:43 +0000
commit68d508a9e03923a5ae6a53a1adff66c4e3f97263 (patch)
tree5994954cfd307defe8bd7805aea06f17ebf9b444 /test/message/events_unhandled_error_common_trace.js
parentf2d93795bfe61a3260bf743d2247b56b83fc6f70 (diff)
downloadandroid-node-v8-68d508a9e03923a5ae6a53a1adff66c4e3f97263.tar.gz
android-node-v8-68d508a9e03923a5ae6a53a1adff66c4e3f97263.tar.bz2
android-node-v8-68d508a9e03923a5ae6a53a1adff66c4e3f97263.zip
events: show throw stack trace for uncaught exception
Show the stack trace for the `eventemitter.emit('error')` call in the case of an uncaught exception. Previously, there would be no clue in Node’s output about where the actual `throw` comes from. PR-URL: https://github.com/nodejs/node/pull/19003 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/message/events_unhandled_error_common_trace.js')
-rw-r--r--test/message/events_unhandled_error_common_trace.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/message/events_unhandled_error_common_trace.js b/test/message/events_unhandled_error_common_trace.js
new file mode 100644
index 0000000000..e6c168fc06
--- /dev/null
+++ b/test/message/events_unhandled_error_common_trace.js
@@ -0,0 +1,20 @@
+'use strict';
+require('../common');
+const EventEmitter = require('events');
+
+function foo() {
+ function bar() {
+ return new Error('foo:bar');
+ }
+
+ return bar();
+}
+
+const ee = new EventEmitter();
+const err = foo();
+
+function quux() {
+ ee.emit('error', err);
+}
+
+quux();