Skip to content

Commit 3450a4c

Browse files
ZYSzyscodebytere
authored andcommitted
lib: gather all errors constant in the same place for consistency
PR-URL: #24038 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 965098a commit 3450a4c

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

lib/net.js

+15-17
Original file line numberDiff line numberDiff line change
@@ -64,31 +64,29 @@ const {
6464
onStreamRead,
6565
kUpdateTimer
6666
} = require('internal/stream_base_commons');
67-
const errors = require('internal/errors');
6867
const {
69-
ERR_INVALID_ADDRESS_FAMILY,
70-
ERR_INVALID_ARG_TYPE,
71-
ERR_INVALID_FD_TYPE,
72-
ERR_INVALID_IP_ADDRESS,
73-
ERR_INVALID_OPT_VALUE,
74-
ERR_SERVER_ALREADY_LISTEN,
75-
ERR_SERVER_NOT_RUNNING,
76-
ERR_SOCKET_BAD_PORT,
77-
ERR_SOCKET_CLOSED
78-
} = errors.codes;
68+
codes: {
69+
ERR_INVALID_ADDRESS_FAMILY,
70+
ERR_INVALID_ARG_TYPE,
71+
ERR_INVALID_FD_TYPE,
72+
ERR_INVALID_IP_ADDRESS,
73+
ERR_INVALID_OPT_VALUE,
74+
ERR_SERVER_ALREADY_LISTEN,
75+
ERR_SERVER_NOT_RUNNING,
76+
ERR_SOCKET_BAD_PORT,
77+
ERR_SOCKET_CLOSED
78+
},
79+
errnoException,
80+
exceptionWithHostPort,
81+
uvExceptionWithHostPort
82+
} = require('internal/errors');
7983
const { validateInt32, validateString } = require('internal/validators');
8084
const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
8185

8286
// Lazy loaded to improve startup performance.
8387
let cluster;
8488
let dns;
8589

86-
const {
87-
errnoException,
88-
exceptionWithHostPort,
89-
uvExceptionWithHostPort
90-
} = errors;
91-
9290
const {
9391
kTimeout,
9492
setUnrefTimeout,

0 commit comments

Comments
 (0)