@@ -110,32 +110,32 @@ module.exports = exports = {
110
110
//
111
111
// Note: Please try to keep these in alphabetical order
112
112
E ( 'ERR_ARG_NOT_ITERABLE' , '%s must be iterable' ) ;
113
- E ( 'ERR_ASSERTION' , ( msg ) => msg ) ;
113
+ E ( 'ERR_ASSERTION' , '%s' ) ;
114
114
E ( 'ERR_CONSOLE_WRITABLE_STREAM' ,
115
- ( name ) => ` Console expects a writable stream instance for ${ name } ` ) ;
116
- E ( 'ERR_CPU_USAGE' , ( errMsg ) => ` Unable to obtain cpu usage ${ errMsg } ` ) ;
115
+ ' Console expects a writable stream instance for %s' ) ;
116
+ E ( 'ERR_CPU_USAGE' , ' Unable to obtain cpu usage %s' ) ;
117
117
E ( 'ERR_FALSY_VALUE_REJECTION' , 'Promise was rejected with falsy value' ) ;
118
118
E ( 'ERR_HTTP_HEADERS_SENT' ,
119
119
'Cannot render headers after they are sent to the client' ) ;
120
- E ( 'ERR_HTTP_INVALID_CHAR ' , 'Invalid character in statusMessage. ' ) ;
121
- E ( 'ERR_HTTP_INVALID_STATUS_CODE ' ,
122
- ( originalStatusCode ) => `Invalid status code: ${ originalStatusCode } ` ) ;
120
+ E ( 'ERR_HTTP_INVALID_STATUS_CODE ' , 'Invalid status code: %s ' ) ;
121
+ E ( 'ERR_HTTP_TRAILER_INVALID ' ,
122
+ 'Trailers are invalid with this transfer encoding' ) ;
123
123
E ( 'ERR_INDEX_OUT_OF_RANGE' , 'Index out of range' ) ;
124
+ E ( 'ERR_INVALID_ARG_TYPE' , invalidArgType ) ;
124
125
E ( 'ERR_INVALID_ARRAY_LENGTH' ,
125
126
( name , length , actual ) => {
126
- let msg = `The "${ name } " array must have a length of ${ length } ` ;
127
- if ( arguments . length > 2 ) {
128
- const len = Array . isArray ( actual ) ? actual . length : actual ;
129
- msg += `. Received length ${ len } ` ;
130
- }
131
- return msg ;
127
+ const assert = lazyAssert ( ) ;
128
+ assert . strictEqual ( typeof actual , 'number' ) ;
129
+ return `The "${ name } " array must have a length of ${
130
+ length } . Received length ${ actual } `;
132
131
} ) ;
133
- E ( 'ERR_INVALID_ARG_TYPE' , invalidArgType ) ;
134
- E ( 'ERR_INVALID_CALLBACK' , 'callback must be a function' ) ;
135
- E ( 'ERR_INVALID_FD' , ( fd ) => `"fd" must be a positive integer: ${ fd } ` ) ;
132
+ E ( 'ERR_INVALID_CALLBACK' , 'Callback must be a function' ) ;
133
+ E ( 'ERR_INVALID_CHAR' , 'Invalid character in %s' ) ;
136
134
E ( 'ERR_INVALID_CURSOR_POS' ,
137
135
'Cannot set cursor row without setting its column' ) ;
138
- E ( 'ERR_INVALID_FILE_URL_HOST' , 'File URL host %s' ) ;
136
+ E ( 'ERR_INVALID_FD' , '"fd" must be a positive integer: %s' ) ;
137
+ E ( 'ERR_INVALID_FILE_URL_HOST' ,
138
+ 'File URL host must be "localhost" or empty on %s' ) ;
139
139
E ( 'ERR_INVALID_FILE_URL_PATH' , 'File URL path %s' ) ;
140
140
E ( 'ERR_INVALID_HANDLE_TYPE' , 'This handle type cannot be sent' ) ;
141
141
E ( 'ERR_INVALID_OPT_VALUE' ,
@@ -144,47 +144,42 @@ E('ERR_INVALID_OPT_VALUE',
144
144
} ) ;
145
145
E ( 'ERR_INVALID_REPL_EVAL_CONFIG' ,
146
146
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL' ) ;
147
+ E ( 'ERR_INVALID_REPL_HISTORY' , 'Expected array, got %s' ) ;
147
148
E ( 'ERR_INVALID_SYNC_FORK_INPUT' ,
148
- ( value ) => {
149
- return 'Asynchronous forks do not support Buffer, Uint8Array or string' +
150
- `input: ${ value } ` ;
151
- } ) ;
149
+ 'Asynchronous forks do not support Buffer, Uint8Array or string input: %s' ) ;
152
150
E ( 'ERR_INVALID_THIS' , 'Value of "this" must be of type %s' ) ;
153
151
E ( 'ERR_INVALID_TUPLE' , '%s must be an iterable %s tuple' ) ;
154
152
E ( 'ERR_INVALID_URL' , 'Invalid URL: %s' ) ;
155
153
E ( 'ERR_INVALID_URL_SCHEME' ,
156
- ( expected ) => `The URL must be ${ oneOf ( expected , 'scheme' ) } ` ) ;
157
- E ( 'ERR_INVALID_REPL_HISTORY' ,
158
- ( repl_history ) => `Expected array, got ${ repl_history } ` ) ;
159
- E ( 'ERR_IPC_CHANNEL_CLOSED' , 'channel closed' ) ;
154
+ ( expected ) => {
155
+ lazyAssert ( ) ;
156
+ return `The URL must be ${ oneOf ( expected , 'scheme' ) } ` ;
157
+ } ) ;
158
+ E ( 'ERR_IPC_CHANNEL_CLOSED' , 'Channel closed' ) ;
160
159
E ( 'ERR_IPC_DISCONNECTED' , 'IPC channel is already disconnected' ) ;
161
160
E ( 'ERR_IPC_ONE_PIPE' , 'Child process can have only one IPC pipe' ) ;
162
161
E ( 'ERR_IPC_SYNC_FORK' , 'IPC cannot be used with synchronous forks' ) ;
163
162
E ( 'ERR_MISSING_ARGS' , missingArgs ) ;
164
- E ( 'ERR_PARSE_HISTORY_DATA' ,
165
- ( oldHistoryPath ) => `Could not parse history data in ${ oldHistoryPath } ` ) ;
163
+ E ( 'ERR_MULTIPLE_CALLBACK' , 'Callback called multiple times' ) ;
166
164
E ( 'ERR_NO_CRYPTO' , 'Node.js is not compiled with OpenSSL crypto support' ) ;
165
+ E ( 'ERR_PARSE_HISTORY_DATA' , 'Could not parse history data in %s' ) ;
166
+ E ( 'ERR_SOCKET_ALREADY_BOUND' , 'Socket is already bound' ) ;
167
+ E ( 'ERR_SOCKET_BAD_TYPE' ,
168
+ 'Bad socket type specified. Valid types are: udp4, udp6' ) ;
169
+ E ( 'ERR_SOCKET_CANNOT_SEND' , 'Unable to send data' ) ;
170
+ E ( 'ERR_SOCKET_BAD_PORT' , 'Port should be > 0 and < 65536' ) ;
171
+ E ( 'ERR_SOCKET_DGRAM_NOT_RUNNING' , 'Not running' ) ;
167
172
E ( 'ERR_STDERR_CLOSE' , 'process.stderr cannot be closed' ) ;
168
173
E ( 'ERR_STDOUT_CLOSE' , 'process.stdout cannot be closed' ) ;
169
174
E ( 'ERR_STREAM_HAS_STRINGDECODER' , 'Stream has StringDecoder' ) ;
170
175
E ( 'ERR_TRANSFORM_ALREADY_TRANSFORMING' ,
171
176
'Calling transform done when still transforming' ) ;
172
- E ( 'ERR_TRANSFORM_MULTIPLE_CALLBACK' , 'Callback called multiple times' ) ;
173
177
E ( 'ERR_TRANSFORM_WITH_LENGTH_0' ,
174
- 'Calling transform done when ws.length != 0' ) ;
175
- E ( 'ERR_HTTP_TRAILER_INVALID' ,
176
- 'Trailers are invalid with this transfer encoding' ) ;
177
- E ( 'ERR_UNKNOWN_BUILTIN_MODULE' , ( id ) => `No such built-in module: ${ id } ` ) ;
178
- E ( 'ERR_UNKNOWN_SIGNAL' , ( signal ) => `Unknown signal: ${ signal } ` ) ;
178
+ 'Calling transform done when writableState.length != 0' ) ;
179
+ E ( 'ERR_UNKNOWN_SIGNAL' , 'Unknown signal: %s' ) ;
179
180
E ( 'ERR_UNKNOWN_STDIN_TYPE' , 'Unknown stdin file type' ) ;
180
181
E ( 'ERR_UNKNOWN_STREAM_TYPE' , 'Unknown stream file type' ) ;
181
- E ( 'ERR_SOCKET_ALREADY_BOUND' , 'Socket is already bound' ) ;
182
- E ( 'ERR_SOCKET_BAD_TYPE' ,
183
- 'Bad socket type specified. Valid types are: udp4, udp6' ) ;
184
- E ( 'ERR_SOCKET_CANNOT_SEND' , 'Unable to send data' ) ;
185
- E ( 'ERR_SOCKET_BAD_PORT' , 'Port should be > 0 and < 65536' ) ;
186
- E ( 'ERR_SOCKET_DGRAM_NOT_RUNNING' , 'Not running' ) ;
187
- E ( 'ERR_V8BREAKITERATOR' , 'full ICU data not installed. ' +
182
+ E ( 'ERR_V8BREAKITERATOR' , 'Full ICU data not installed. ' +
188
183
'See https://github.com/nodejs/node/wiki/Intl' ) ;
189
184
// Add new errors from here...
190
185
@@ -200,6 +195,7 @@ function invalidArgType(name, expected, actual) {
200
195
}
201
196
202
197
function missingArgs ( ...args ) {
198
+ const assert = lazyAssert ( ) ;
203
199
assert ( args . length > 0 , 'At least one arg needs to be specified' ) ;
204
200
let msg = 'The ' ;
205
201
const len = args . length ;
0 commit comments