0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-event-emitter-errors.js
James M Snell e5ad5456a2 events: migrate to internal/errors
PR-URL: https://github.com/nodejs/node/pull/15623
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2017-10-13 14:16:13 -07:00

24 lines
485 B
JavaScript

'use strict';
const common = require('../common');
const EventEmitter = require('events');
const EE = new EventEmitter();
common.expectsError(
() => EE.emit('error', 'Accepts a string'),
{
code: 'ERR_UNHANDLED_ERROR',
type: Error,
message: 'Unhandled error. (Accepts a string)'
}
);
common.expectsError(
() => EE.emit('error', { message: 'Error!' }),
{
code: 'ERR_UNHANDLED_ERROR',
type: Error,
message: 'Unhandled error. ([object Object])'
}
);