0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/message/events_unhandled_error_subclass.js
Anna Henningsen 4c9fb0b706 events: give subclass name in unhandled 'error' message
For unhandled `'error'` events, include the constructor name for
subclasses of EventEmitter, if possible. This makes tracing errors
easier when both creation of the `Error` object and emitting it
happen in code that does not refer back to the event emitter.

PR-URL: https://github.com/nodejs/node/pull/28952
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-08-06 19:28:12 -07:00

6 lines
148 B
JavaScript

'use strict';
require('../common');
const EventEmitter = require('events');
class Foo extends EventEmitter {}
new Foo().emit('error', new Error());