@@ -110,32 +110,32 @@ module.exports = exports = {
110110//
111111// Note: Please try to keep these in alphabetical order
112112E ( 'ERR_ARG_NOT_ITERABLE' , '%s must be iterable' ) ;
113- E ( 'ERR_ASSERTION' , ( msg ) => msg ) ;
113+ E ( 'ERR_ASSERTION' , '%s' ) ;
114114E ( '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' ) ;
117117E ( 'ERR_FALSY_VALUE_REJECTION' , 'Promise was rejected with falsy value' ) ;
118118E ( 'ERR_HTTP_HEADERS_SENT' ,
119119 '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' ) ;
123123E ( 'ERR_INDEX_OUT_OF_RANGE' , 'Index out of range' ) ;
124+ E ( 'ERR_INVALID_ARG_TYPE' , invalidArgType ) ;
124125E ( 'ERR_INVALID_ARRAY_LENGTH' ,
125126 ( 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 } `;
132131 } ) ;
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' ) ;
136134E ( 'ERR_INVALID_CURSOR_POS' ,
137135 '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' ) ;
139139E ( 'ERR_INVALID_FILE_URL_PATH' , 'File URL path %s' ) ;
140140E ( 'ERR_INVALID_HANDLE_TYPE' , 'This handle type cannot be sent' ) ;
141141E ( 'ERR_INVALID_OPT_VALUE' ,
@@ -144,47 +144,42 @@ E('ERR_INVALID_OPT_VALUE',
144144 } ) ;
145145E ( 'ERR_INVALID_REPL_EVAL_CONFIG' ,
146146 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL' ) ;
147+ E ( 'ERR_INVALID_REPL_HISTORY' , 'Expected array, got %s' ) ;
147148E ( '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' ) ;
152150E ( 'ERR_INVALID_THIS' , 'Value of "this" must be of type %s' ) ;
153151E ( 'ERR_INVALID_TUPLE' , '%s must be an iterable %s tuple' ) ;
154152E ( 'ERR_INVALID_URL' , 'Invalid URL: %s' ) ;
155153E ( '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' ) ;
160159E ( 'ERR_IPC_DISCONNECTED' , 'IPC channel is already disconnected' ) ;
161160E ( 'ERR_IPC_ONE_PIPE' , 'Child process can have only one IPC pipe' ) ;
162161E ( 'ERR_IPC_SYNC_FORK' , 'IPC cannot be used with synchronous forks' ) ;
163162E ( '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' ) ;
166164E ( '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' ) ;
167172E ( 'ERR_STDERR_CLOSE' , 'process.stderr cannot be closed' ) ;
168173E ( 'ERR_STDOUT_CLOSE' , 'process.stdout cannot be closed' ) ;
169174E ( 'ERR_STREAM_HAS_STRINGDECODER' , 'Stream has StringDecoder' ) ;
170175E ( 'ERR_TRANSFORM_ALREADY_TRANSFORMING' ,
171176 'Calling transform done when still transforming' ) ;
172- E ( 'ERR_TRANSFORM_MULTIPLE_CALLBACK' , 'Callback called multiple times' ) ;
173177E ( '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' ) ;
179180E ( 'ERR_UNKNOWN_STDIN_TYPE' , 'Unknown stdin file type' ) ;
180181E ( '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. ' +
188183 'See https://github.com/nodejs/node/wiki/Intl' ) ;
189184// Add new errors from here...
190185
@@ -200,6 +195,7 @@ function invalidArgType(name, expected, actual) {
200195}
201196
202197function missingArgs ( ...args ) {
198+ const assert = lazyAssert ( ) ;
203199 assert ( args . length > 0 , 'At least one arg needs to be specified' ) ;
204200 let msg = 'The ' ;
205201 const len = args . length ;
0 commit comments