File tree 2 files changed +8
-4
lines changed
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,7 @@ EventEmitter.prototype.emit = function emit(type) {
171
171
er = arguments [ 1 ] ;
172
172
if ( domain ) {
173
173
if ( ! er )
174
- er = new Error ( 'Uncaught, unspecified "error" event' ) ;
174
+ er = new Error ( 'Unhandled "error" event' ) ;
175
175
if ( typeof er === 'object' && er !== null ) {
176
176
er . domainEmitter = this ;
177
177
er . domain = domain ;
@@ -182,7 +182,7 @@ EventEmitter.prototype.emit = function emit(type) {
182
182
throw er ; // Unhandled 'error' event
183
183
} else {
184
184
// At least give some kind of context to the user
185
- var err = new Error ( 'Uncaught, unspecified "error" event. (' + er + ')' ) ;
185
+ const err = new Error ( 'Unhandled "error" event. (' + er + ')' ) ;
186
186
err . context = er ;
187
187
throw err ;
188
188
}
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ const assert = require('assert');
5
5
6
6
const EE = new EventEmitter ( ) ;
7
7
8
- assert . throws ( function ( ) {
8
+ assert . throws ( ( ) => {
9
9
EE . emit ( 'error' , 'Accepts a string' ) ;
10
- } , / A c c e p t s a s t r i n g / ) ;
10
+ } , / ^ E r r o r : U n h a n d l e d " e r r o r " e v e n t \. \( A c c e p t s a s t r i n g \) $ / ) ;
11
+
12
+ assert . throws ( ( ) => {
13
+ EE . emit ( 'error' , { message : 'Error!' } ) ;
14
+ } , / ^ E r r o r : U n h a n d l e d " e r r o r " e v e n t \. \( \[ o b j e c t O b j e c t \] \) $ / ) ;
You can’t perform that action at this time.
0 commit comments