mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
68d508a9e0
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>
21 lines
275 B
JavaScript
21 lines
275 B
JavaScript
'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();
|