0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 23:16:30 +01:00
nodejs/test/message/events_unhandled_error_nexttick.js
Anna Henningsen 68d508a9e0
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>
2018-03-04 21:20:43 +00:00

8 lines
169 B
JavaScript

'use strict';
require('../common');
const EventEmitter = require('events');
const er = new Error();
process.nextTick(() => {
new EventEmitter().emit('error', er);
});