errors.js 344 B

12345678910111213
  1. 'use strict';
  2. var assert = require('assert');
  3. var EventEmitter = require('../');
  4. var EE = new EventEmitter();
  5. assert.throws(function () {
  6. EE.emit('error', 'Accepts a string');
  7. }, 'Error: Unhandled error. (Accepts a string)');
  8. assert.throws(function () {
  9. EE.emit('error', { message: 'Error!' });
  10. }, 'Unhandled error. ([object Object])');