11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst EventEmitter = require('events'); 51cb0ef41Sopenharmony_ciconst util = require('util'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst EE = new EventEmitter(); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciassert.throws( 101cb0ef41Sopenharmony_ci () => EE.emit('error', 'Accepts a string'), 111cb0ef41Sopenharmony_ci { 121cb0ef41Sopenharmony_ci code: 'ERR_UNHANDLED_ERROR', 131cb0ef41Sopenharmony_ci name: 'Error', 141cb0ef41Sopenharmony_ci message: "Unhandled error. ('Accepts a string')", 151cb0ef41Sopenharmony_ci } 161cb0ef41Sopenharmony_ci); 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ciassert.throws( 191cb0ef41Sopenharmony_ci () => EE.emit('error', { message: 'Error!' }), 201cb0ef41Sopenharmony_ci { 211cb0ef41Sopenharmony_ci code: 'ERR_UNHANDLED_ERROR', 221cb0ef41Sopenharmony_ci name: 'Error', 231cb0ef41Sopenharmony_ci message: "Unhandled error. ({ message: 'Error!' })", 241cb0ef41Sopenharmony_ci } 251cb0ef41Sopenharmony_ci); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ciassert.throws( 281cb0ef41Sopenharmony_ci () => EE.emit('error', { 291cb0ef41Sopenharmony_ci message: 'Error!', 301cb0ef41Sopenharmony_ci [util.inspect.custom]() { throw new Error(); }, 311cb0ef41Sopenharmony_ci }), 321cb0ef41Sopenharmony_ci { 331cb0ef41Sopenharmony_ci code: 'ERR_UNHANDLED_ERROR', 341cb0ef41Sopenharmony_ci name: 'Error', 351cb0ef41Sopenharmony_ci message: 'Unhandled error. ([object Object])', 361cb0ef41Sopenharmony_ci } 371cb0ef41Sopenharmony_ci); 38