mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
2141d37452
Update error message that's thrown when no error listeners are attached to an emitter. PR-URL: https://github.com/nodejs/node/pull/10387 Reviewed-By: Sam Roberts <vieuxtech@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Italo A. Casas <me@italoacasas.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
15 lines
396 B
JavaScript
15 lines
396 B
JavaScript
'use strict';
|
|
require('../common');
|
|
const EventEmitter = require('events');
|
|
const assert = require('assert');
|
|
|
|
const EE = new EventEmitter();
|
|
|
|
assert.throws(() => {
|
|
EE.emit('error', 'Accepts a string');
|
|
}, /^Error: Unhandled "error" event\. \(Accepts a string\)$/);
|
|
|
|
assert.throws(() => {
|
|
EE.emit('error', {message: 'Error!'});
|
|
}, /^Error: Unhandled "error" event\. \(\[object Object\]\)$/);
|