1
1
/* eslint documented-errors: "error" */
2
2
/* eslint alphabetize-errors: "error" */
3
+ /* eslint prefer-util-format-errors: "error" */
3
4
4
5
'use strict' ;
5
6
@@ -146,8 +147,8 @@ module.exports = exports = {
146
147
// Note: Please try to keep these in alphabetical order
147
148
E ( 'ERR_ARG_NOT_ITERABLE' , '%s must be iterable' ) ;
148
149
E ( 'ERR_ASSERTION' , '%s' ) ;
149
- E ( 'ERR_ASYNC_CALLBACK' , ( name ) => ` ${ name } must be a function` ) ;
150
- E ( 'ERR_ASYNC_TYPE' , ( s ) => ` Invalid name for async "type": ${ s } ` ) ;
150
+ E ( 'ERR_ASYNC_CALLBACK' , '%s must be a function' ) ;
151
+ E ( 'ERR_ASYNC_TYPE' , ' Invalid name for async "type": %s' ) ;
151
152
E ( 'ERR_BUFFER_OUT_OF_BOUNDS' , bufferOutOfBounds ) ;
152
153
E ( 'ERR_BUFFER_TOO_LARGE' ,
153
154
`Cannot create a Buffer larger than 0x${ kMaxLength . toString ( 16 ) } bytes` ) ;
@@ -169,12 +170,10 @@ E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s');
169
170
E ( 'ERR_CRYPTO_SIGN_KEY_REQUIRED' , 'No key provided to sign' ) ;
170
171
E ( 'ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH' ,
171
172
'Input buffers must have the same length' ) ;
172
- E ( 'ERR_DNS_SET_SERVERS_FAILED' , ( err , servers ) =>
173
- `c-ares failed to set servers: "${ err } " [${ servers } ]` ) ;
173
+ E ( 'ERR_DNS_SET_SERVERS_FAILED' , 'c-ares failed to set servers: "%s" [%s]' ) ;
174
174
E ( 'ERR_ENCODING_INVALID_ENCODED_DATA' ,
175
- ( enc ) => `The encoded data was not valid for encoding ${ enc } ` ) ;
176
- E ( 'ERR_ENCODING_NOT_SUPPORTED' ,
177
- ( enc ) => `The "${ enc } " encoding is not supported` ) ;
175
+ 'The encoded data was not valid for encoding %s' ) ;
176
+ E ( 'ERR_ENCODING_NOT_SUPPORTED' , 'The "%s" encoding is not supported' ) ;
178
177
E ( 'ERR_FALSY_VALUE_REJECTION' , 'Promise was rejected with falsy value' ) ;
179
178
E ( 'ERR_HTTP2_CONNECT_AUTHORITY' ,
180
179
':authority header is required for CONNECT requests' ) ;
@@ -194,10 +193,9 @@ E('ERR_HTTP2_HEADERS_AFTER_RESPOND',
194
193
'Cannot specify additional headers after response initiated' ) ;
195
194
E ( 'ERR_HTTP2_HEADERS_OBJECT' , 'Headers must be an object' ) ;
196
195
E ( 'ERR_HTTP2_HEADERS_SENT' , 'Response has already been initiated.' ) ;
197
- E ( 'ERR_HTTP2_HEADER_REQUIRED' ,
198
- ( name ) => `The ${ name } header is required` ) ;
196
+ E ( 'ERR_HTTP2_HEADER_REQUIRED' , 'The %s header is required' ) ;
199
197
E ( 'ERR_HTTP2_HEADER_SINGLE_VALUE' ,
200
- ( name ) => ` Header field "${ name } " must have only a single value` ) ;
198
+ ' Header field "%s " must have only a single value' ) ;
201
199
E ( 'ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND' ,
202
200
'Cannot send informational headers after the HTTP message has been sent' ) ;
203
201
E ( 'ERR_HTTP2_INFO_STATUS_NOT_ALLOWED' ,
@@ -206,23 +204,23 @@ E('ERR_HTTP2_INVALID_CONNECTION_HEADERS',
206
204
'HTTP/1 Connection specific headers are forbidden: "%s"' ) ;
207
205
E ( 'ERR_HTTP2_INVALID_HEADER_VALUE' , 'Invalid value "%s" for header "%s"' ) ;
208
206
E ( 'ERR_HTTP2_INVALID_INFO_STATUS' ,
209
- ( code ) => ` Invalid informational status code: ${ code } ` ) ;
207
+ ' Invalid informational status code: %s' ) ;
210
208
E ( 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH' ,
211
209
'Packed settings length must be a multiple of six' ) ;
212
210
E ( 'ERR_HTTP2_INVALID_PSEUDOHEADER' ,
213
- ( name ) => `" ${ name } " is an invalid pseudoheader or is used incorrectly` ) ;
211
+ '"%s " is an invalid pseudoheader or is used incorrectly' ) ;
214
212
E ( 'ERR_HTTP2_INVALID_SESSION' , 'The session has been destroyed' ) ;
215
213
E ( 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
216
- ( name , value ) => ` Invalid value for setting "${ name } ": ${ value } ` ) ;
214
+ ' Invalid value for setting "%s ": %s' ) ;
217
215
E ( 'ERR_HTTP2_INVALID_STREAM' , 'The stream has been destroyed' ) ;
218
216
E ( 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK' ,
219
- ( max ) => ` Maximum number of pending settings acknowledgements (${ max } )` ) ;
217
+ ' Maximum number of pending settings acknowledgements (%s)' ) ;
220
218
E ( 'ERR_HTTP2_NO_SOCKET_MANIPULATION' ,
221
219
'HTTP/2 sockets should not be directly manipulated (e.g. read and written)' ) ;
222
220
E ( 'ERR_HTTP2_OUT_OF_STREAMS' ,
223
221
'No stream ID is available because maximum stream ID has been reached' ) ;
224
222
E ( 'ERR_HTTP2_PAYLOAD_FORBIDDEN' ,
225
- ( code ) => ` Responses with ${ code } status must not have a payload` ) ;
223
+ ' Responses with %s status must not have a payload' ) ;
226
224
E ( 'ERR_HTTP2_PING_CANCEL' , 'HTTP2 ping cancelled' ) ;
227
225
E ( 'ERR_HTTP2_PING_LENGTH' , 'HTTP2 ping payload must be 8 bytes' ) ;
228
226
E ( 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED' , 'Cannot set HTTP/2 pseudo-headers' ) ;
@@ -232,19 +230,15 @@ E('ERR_HTTP2_SOCKET_BOUND',
232
230
'The socket is already bound to an Http2Session' ) ;
233
231
E ( 'ERR_HTTP2_STATUS_101' ,
234
232
'HTTP status code 101 (Switching Protocols) is forbidden in HTTP/2' ) ;
235
- E ( 'ERR_HTTP2_STATUS_INVALID' ,
236
- ( code ) => `Invalid status code: ${ code } ` ) ;
233
+ E ( 'ERR_HTTP2_STATUS_INVALID' , 'Invalid status code: %s' ) ;
237
234
E ( 'ERR_HTTP2_STREAM_CLOSED' , 'The stream is already closed' ) ;
238
- E ( 'ERR_HTTP2_STREAM_ERROR' ,
239
- ( code ) => `Stream closed with error code ${ code } ` ) ;
235
+ E ( 'ERR_HTTP2_STREAM_ERROR' , 'Stream closed with error code %s' ) ;
240
236
E ( 'ERR_HTTP2_STREAM_SELF_DEPENDENCY' , 'A stream cannot depend on itself' ) ;
241
- E ( 'ERR_HTTP2_UNSUPPORTED_PROTOCOL' ,
242
- ( protocol ) => `protocol "${ protocol } " is unsupported.` ) ;
237
+ E ( 'ERR_HTTP2_UNSUPPORTED_PROTOCOL' , 'protocol "%s" is unsupported.' ) ;
243
238
E ( 'ERR_HTTP_HEADERS_SENT' ,
244
239
'Cannot %s headers after they are sent to the client' ) ;
245
240
E ( 'ERR_HTTP_INVALID_CHAR' , 'Invalid character in statusMessage.' ) ;
246
- E ( 'ERR_HTTP_INVALID_STATUS_CODE' ,
247
- ( originalStatusCode ) => `Invalid status code: ${ originalStatusCode } ` ) ;
241
+ E ( 'ERR_HTTP_INVALID_STATUS_CODE' , 'Invalid status code: %s' ) ;
248
242
E ( 'ERR_HTTP_TRAILER_INVALID' ,
249
243
'Trailers are invalid with this transfer encoding' ) ;
250
244
E ( 'ERR_INDEX_OUT_OF_RANGE' , 'Index out of range' ) ;
@@ -253,16 +247,14 @@ E('ERR_INSPECTOR_CLOSED', 'Session was closed');
253
247
E ( 'ERR_INSPECTOR_NOT_AVAILABLE' , 'Inspector is not available' ) ;
254
248
E ( 'ERR_INSPECTOR_NOT_CONNECTED' , 'Session is not connected' ) ;
255
249
E ( 'ERR_INVALID_ARG_TYPE' , invalidArgType ) ;
256
- E ( 'ERR_INVALID_ARG_VALUE' ,
257
- ( name , value ) => {
258
- return `The value "${ String ( value ) } " is invalid for argument "${ name } "` ;
259
- } ) ;
250
+ E ( 'ERR_INVALID_ARG_VALUE' , ( name , value ) =>
251
+ `The value "${ String ( value ) } " is invalid for argument "${ name } "` ) ;
260
252
E ( 'ERR_INVALID_ARRAY_LENGTH' ,
261
253
( name , len , actual ) => {
262
254
internalAssert ( typeof actual === 'number' , 'actual must be a number' ) ;
263
255
return `The array "${ name } " (length ${ actual } ) must be of length ${ len } .` ;
264
256
} ) ;
265
- E ( 'ERR_INVALID_ASYNC_ID' , ( type , id ) => ` Invalid ${ type } value: ${ id } ` ) ;
257
+ E ( 'ERR_INVALID_ASYNC_ID' , ' Invalid %s value: %s' ) ;
266
258
E ( 'ERR_INVALID_BUFFER_SIZE' , 'Buffer size must be a multiple of %s' ) ;
267
259
E ( 'ERR_INVALID_CALLBACK' , 'Callback must be a function' ) ;
268
260
E ( 'ERR_INVALID_CHAR' , invalidChar ) ;
@@ -277,15 +269,12 @@ E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s');
277
269
E ( 'ERR_INVALID_HANDLE_TYPE' , 'This handle type cannot be sent' ) ;
278
270
E ( 'ERR_INVALID_HTTP_TOKEN' , '%s must be a valid HTTP token ["%s"]' ) ;
279
271
E ( 'ERR_INVALID_IP_ADDRESS' , 'Invalid IP address: %s' ) ;
280
- E ( 'ERR_INVALID_OPT_VALUE' ,
281
- ( name , value ) => {
282
- return `The value "${ String ( value ) } " is invalid for option "${ name } "` ;
283
- } ) ;
272
+ E ( 'ERR_INVALID_OPT_VALUE' , ( name , value ) =>
273
+ `The value "${ String ( value ) } " is invalid for option "${ name } "` ) ;
284
274
E ( 'ERR_INVALID_OPT_VALUE_ENCODING' ,
285
- ( value ) => ` The value "${ String ( value ) } " is invalid for option "encoding"` ) ;
275
+ ' The value "%s " is invalid for option "encoding"' ) ;
286
276
E ( 'ERR_INVALID_PERFORMANCE_MARK' , 'The "%s" performance mark has not been set' ) ;
287
- E ( 'ERR_INVALID_PROTOCOL' , ( protocol , expectedProtocol ) =>
288
- `Protocol "${ protocol } " not supported. Expected "${ expectedProtocol } "` ) ;
277
+ E ( 'ERR_INVALID_PROTOCOL' , 'Protocol "%s" not supported. Expected "%s"' ) ;
289
278
E ( 'ERR_INVALID_REPL_EVAL_CONFIG' ,
290
279
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL' ) ;
291
280
E ( 'ERR_INVALID_SYNC_FORK_INPUT' ,
@@ -325,8 +314,7 @@ E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer');
325
314
E ( 'ERR_SOCKET_BAD_PORT' , 'Port should be > 0 and < 65536. Received %s.' ) ;
326
315
E ( 'ERR_SOCKET_BAD_TYPE' ,
327
316
'Bad socket type specified. Valid types are: udp4, udp6' ) ;
328
- E ( 'ERR_SOCKET_BUFFER_SIZE' ,
329
- ( reason ) => `Could not get or set buffer size: ${ reason } ` ) ;
317
+ E ( 'ERR_SOCKET_BUFFER_SIZE' , 'Could not get or set buffer size: %s' ) ;
330
318
E ( 'ERR_SOCKET_CANNOT_SEND' , 'Unable to send data' ) ;
331
319
E ( 'ERR_SOCKET_CLOSED' , 'Socket is closed' ) ;
332
320
E ( 'ERR_SOCKET_DGRAM_NOT_RUNNING' , 'Not running' ) ;
@@ -341,8 +329,7 @@ E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode');
341
329
E ( 'ERR_STREAM_WRITE_AFTER_END' , 'write after end' ) ;
342
330
E ( 'ERR_TLS_CERT_ALTNAME_INVALID' ,
343
331
'Hostname/IP does not match certificate\'s altnames: %s' ) ;
344
- E ( 'ERR_TLS_DH_PARAM_SIZE' , ( size ) =>
345
- `DH parameter size ${ size } is less than 2048` ) ;
332
+ E ( 'ERR_TLS_DH_PARAM_SIZE' , 'DH parameter size %s is less than 2048' ) ;
346
333
E ( 'ERR_TLS_HANDSHAKE_TIMEOUT' , 'TLS handshake timeout' ) ;
347
334
E ( 'ERR_TLS_RENEGOTIATION_FAILED' , 'Failed to renegotiate' ) ;
348
335
E ( 'ERR_TLS_REQUIRED_SERVER_NAME' ,
@@ -352,8 +339,7 @@ E('ERR_TRANSFORM_ALREADY_TRANSFORMING',
352
339
'Calling transform done when still transforming' ) ;
353
340
E ( 'ERR_TRANSFORM_WITH_LENGTH_0' ,
354
341
'Calling transform done when writableState.length != 0' ) ;
355
- E ( 'ERR_UNESCAPED_CHARACTERS' ,
356
- ( name ) => `${ name } contains unescaped characters` ) ;
342
+ E ( 'ERR_UNESCAPED_CHARACTERS' , '%s contains unescaped characters' ) ;
357
343
E ( 'ERR_UNHANDLED_ERROR' ,
358
344
( err ) => {
359
345
const msg = 'Unhandled error.' ;
0 commit comments