File tree Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- var common = require ( '../common' ) ;
3- var assert = require ( 'assert' ) ;
4- var net = require ( 'net' ) ;
2+ const common = require ( '../common' ) ;
3+ const assert = require ( 'assert' ) ;
4+ const net = require ( 'net' ) ;
55
6- var gotError = false ;
7-
8- process . on ( 'exit' , function ( ) {
9- assert ( gotError instanceof Error ) ;
10- } ) ;
11-
12- // this should fail with an async EINVAL error, not throw an exception
13- net . createServer ( common . fail ) . listen ( { fd : 0 } ) . on ( 'error' , function ( e ) {
14- switch ( e . code ) {
15- case 'EINVAL' :
16- case 'ENOTSOCK' :
17- gotError = e ;
18- break ;
19- }
20- } ) ;
6+ // This should fail with an async EINVAL error, not throw an exception
7+ net . createServer ( common . fail )
8+ . listen ( { fd : 0 } )
9+ . on ( 'error' , common . mustCall ( function ( e ) {
10+ assert ( e instanceof Error ) ;
11+ assert ( [ 'EINVAL' , 'ENOTSOCK' ] . includes ( e . code ) ) ;
12+ } ) ) ;
You can’t perform that action at this time.
0 commit comments