Skip to content

Commit bc5a0d3

Browse files
ZYSzysrvagg
authored andcommitted
lib: gather all errors constant in the same place for consistency
PR-URL: #24038 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 01e8a3a commit bc5a0d3

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

lib/net.js

+16-18
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,30 @@ 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_ARG_VALUE,
72-
ERR_INVALID_FD_TYPE,
73-
ERR_INVALID_IP_ADDRESS,
74-
ERR_INVALID_OPT_VALUE,
75-
ERR_SERVER_ALREADY_LISTEN,
76-
ERR_SERVER_NOT_RUNNING,
77-
ERR_SOCKET_BAD_PORT,
78-
ERR_SOCKET_CLOSED
79-
} = errors.codes;
68+
codes: {
69+
ERR_INVALID_ADDRESS_FAMILY,
70+
ERR_INVALID_ARG_TYPE,
71+
ERR_INVALID_ARG_VALUE,
72+
ERR_INVALID_FD_TYPE,
73+
ERR_INVALID_IP_ADDRESS,
74+
ERR_INVALID_OPT_VALUE,
75+
ERR_SERVER_ALREADY_LISTEN,
76+
ERR_SERVER_NOT_RUNNING,
77+
ERR_SOCKET_BAD_PORT,
78+
ERR_SOCKET_CLOSED
79+
},
80+
errnoException,
81+
exceptionWithHostPort,
82+
uvExceptionWithHostPort
83+
} = require('internal/errors');
8084
const { validateInt32, validateString } = require('internal/validators');
8185
const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
8286

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

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

0 commit comments

Comments
 (0)