11/* eslint documented-errors: "error" */
22/* eslint alphabetize-errors: "error" */
3+ /* eslint prefer-util-format-errors: "error" */
34
45'use strict' ;
56
@@ -146,8 +147,8 @@ module.exports = exports = {
146147// Note: Please try to keep these in alphabetical order
147148E ( 'ERR_ARG_NOT_ITERABLE' , '%s must be iterable' ) ;
148149E ( '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' ) ;
151152E ( 'ERR_BUFFER_OUT_OF_BOUNDS' , bufferOutOfBounds ) ;
152153E ( 'ERR_BUFFER_TOO_LARGE' ,
153154 `Cannot create a Buffer larger than 0x${ kMaxLength . toString ( 16 ) } bytes` ) ;
@@ -169,12 +170,10 @@ E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s');
169170E ( 'ERR_CRYPTO_SIGN_KEY_REQUIRED' , 'No key provided to sign' ) ;
170171E ( 'ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH' ,
171172 '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]' ) ;
174174E ( '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' ) ;
178177E ( 'ERR_FALSY_VALUE_REJECTION' , 'Promise was rejected with falsy value' ) ;
179178E ( 'ERR_HTTP2_CONNECT_AUTHORITY' ,
180179 ':authority header is required for CONNECT requests' ) ;
@@ -194,10 +193,9 @@ E('ERR_HTTP2_HEADERS_AFTER_RESPOND',
194193 'Cannot specify additional headers after response initiated' ) ;
195194E ( 'ERR_HTTP2_HEADERS_OBJECT' , 'Headers must be an object' ) ;
196195E ( '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' ) ;
199197E ( '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' ) ;
201199E ( 'ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND' ,
202200 'Cannot send informational headers after the HTTP message has been sent' ) ;
203201E ( 'ERR_HTTP2_INFO_STATUS_NOT_ALLOWED' ,
@@ -206,23 +204,23 @@ E('ERR_HTTP2_INVALID_CONNECTION_HEADERS',
206204 'HTTP/1 Connection specific headers are forbidden: "%s"' ) ;
207205E ( 'ERR_HTTP2_INVALID_HEADER_VALUE' , 'Invalid value "%s" for header "%s"' ) ;
208206E ( 'ERR_HTTP2_INVALID_INFO_STATUS' ,
209- ( code ) => ` Invalid informational status code: ${ code } ` ) ;
207+ ' Invalid informational status code: %s' ) ;
210208E ( 'ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH' ,
211209 'Packed settings length must be a multiple of six' ) ;
212210E ( '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' ) ;
214212E ( 'ERR_HTTP2_INVALID_SESSION' , 'The session has been destroyed' ) ;
215213E ( 'ERR_HTTP2_INVALID_SETTING_VALUE' ,
216- ( name , value ) => ` Invalid value for setting "${ name } ": ${ value } ` ) ;
214+ ' Invalid value for setting "%s ": %s' ) ;
217215E ( 'ERR_HTTP2_INVALID_STREAM' , 'The stream has been destroyed' ) ;
218216E ( 'ERR_HTTP2_MAX_PENDING_SETTINGS_ACK' ,
219- ( max ) => ` Maximum number of pending settings acknowledgements (${ max } )` ) ;
217+ ' Maximum number of pending settings acknowledgements (%s)' ) ;
220218E ( 'ERR_HTTP2_NO_SOCKET_MANIPULATION' ,
221219 'HTTP/2 sockets should not be directly manipulated (e.g. read and written)' ) ;
222220E ( 'ERR_HTTP2_OUT_OF_STREAMS' ,
223221 'No stream ID is available because maximum stream ID has been reached' ) ;
224222E ( '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' ) ;
226224E ( 'ERR_HTTP2_PING_CANCEL' , 'HTTP2 ping cancelled' ) ;
227225E ( 'ERR_HTTP2_PING_LENGTH' , 'HTTP2 ping payload must be 8 bytes' ) ;
228226E ( 'ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED' , 'Cannot set HTTP/2 pseudo-headers' ) ;
@@ -232,19 +230,15 @@ E('ERR_HTTP2_SOCKET_BOUND',
232230 'The socket is already bound to an Http2Session' ) ;
233231E ( 'ERR_HTTP2_STATUS_101' ,
234232 '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' ) ;
237234E ( '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' ) ;
240236E ( '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.' ) ;
243238E ( 'ERR_HTTP_HEADERS_SENT' ,
244239 'Cannot %s headers after they are sent to the client' ) ;
245240E ( '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' ) ;
248242E ( 'ERR_HTTP_TRAILER_INVALID' ,
249243 'Trailers are invalid with this transfer encoding' ) ;
250244E ( 'ERR_INDEX_OUT_OF_RANGE' , 'Index out of range' ) ;
@@ -253,16 +247,14 @@ E('ERR_INSPECTOR_CLOSED', 'Session was closed');
253247E ( 'ERR_INSPECTOR_NOT_AVAILABLE' , 'Inspector is not available' ) ;
254248E ( 'ERR_INSPECTOR_NOT_CONNECTED' , 'Session is not connected' ) ;
255249E ( '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 } "` ) ;
260252E ( 'ERR_INVALID_ARRAY_LENGTH' ,
261253 ( name , len , actual ) => {
262254 internalAssert ( typeof actual === 'number' , 'actual must be a number' ) ;
263255 return `The array "${ name } " (length ${ actual } ) must be of length ${ len } .` ;
264256 } ) ;
265- E ( 'ERR_INVALID_ASYNC_ID' , ( type , id ) => ` Invalid ${ type } value: ${ id } ` ) ;
257+ E ( 'ERR_INVALID_ASYNC_ID' , ' Invalid %s value: %s' ) ;
266258E ( 'ERR_INVALID_BUFFER_SIZE' , 'Buffer size must be a multiple of %s' ) ;
267259E ( 'ERR_INVALID_CALLBACK' , 'Callback must be a function' ) ;
268260E ( 'ERR_INVALID_CHAR' , invalidChar ) ;
@@ -277,15 +269,12 @@ E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s');
277269E ( 'ERR_INVALID_HANDLE_TYPE' , 'This handle type cannot be sent' ) ;
278270E ( 'ERR_INVALID_HTTP_TOKEN' , '%s must be a valid HTTP token ["%s"]' ) ;
279271E ( '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 } "` ) ;
284274E ( '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"' ) ;
286276E ( '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"' ) ;
289278E ( 'ERR_INVALID_REPL_EVAL_CONFIG' ,
290279 'Cannot specify both "breakEvalOnSigint" and "eval" for REPL' ) ;
291280E ( 'ERR_INVALID_SYNC_FORK_INPUT' ,
@@ -325,8 +314,7 @@ E('ERR_SOCKET_BAD_BUFFER_SIZE', 'Buffer size must be a positive integer');
325314E ( 'ERR_SOCKET_BAD_PORT' , 'Port should be > 0 and < 65536. Received %s.' ) ;
326315E ( 'ERR_SOCKET_BAD_TYPE' ,
327316 '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' ) ;
330318E ( 'ERR_SOCKET_CANNOT_SEND' , 'Unable to send data' ) ;
331319E ( 'ERR_SOCKET_CLOSED' , 'Socket is closed' ) ;
332320E ( 'ERR_SOCKET_DGRAM_NOT_RUNNING' , 'Not running' ) ;
@@ -341,8 +329,7 @@ E('ERR_STREAM_WRAP', 'Stream has StringDecoder set or is in objectMode');
341329E ( 'ERR_STREAM_WRITE_AFTER_END' , 'write after end' ) ;
342330E ( 'ERR_TLS_CERT_ALTNAME_INVALID' ,
343331 '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' ) ;
346333E ( 'ERR_TLS_HANDSHAKE_TIMEOUT' , 'TLS handshake timeout' ) ;
347334E ( 'ERR_TLS_RENEGOTIATION_FAILED' , 'Failed to renegotiate' ) ;
348335E ( 'ERR_TLS_REQUIRED_SERVER_NAME' ,
@@ -352,8 +339,7 @@ E('ERR_TRANSFORM_ALREADY_TRANSFORMING',
352339 'Calling transform done when still transforming' ) ;
353340E ( 'ERR_TRANSFORM_WITH_LENGTH_0' ,
354341 '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' ) ;
357343E ( 'ERR_UNHANDLED_ERROR' ,
358344 ( err ) => {
359345 const msg = 'Unhandled error.' ;
0 commit comments