mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
errors: add comments about falsy error types
Some error types are not properly set. This adds comments which ones are probably falty and to what they should be set instead. PR-URL: https://github.com/nodejs/node/pull/18857 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This commit is contained in:
@@ -622,6 +622,8 @@ E('ERR_CRYPTO_HASH_FINALIZED', 'Digest already called', Error);
|
||||
E('ERR_CRYPTO_HASH_UPDATE_FAILED', 'Hash update failed', Error);
|
||||
E('ERR_CRYPTO_INVALID_DIGEST', 'Invalid digest: %s', TypeError);
|
||||
E('ERR_CRYPTO_INVALID_STATE', 'Invalid state for operation %s', Error);
|
||||
|
||||
// Switch to TypeError. The current implementation does not seem right.
|
||||
E('ERR_CRYPTO_SIGN_KEY_REQUIRED', 'No key provided to sign', Error);
|
||||
E('ERR_CRYPTO_TIMING_SAFE_EQUAL_LENGTH',
|
||||
'Input buffers must have the same length', RangeError);
|
||||
@@ -643,7 +645,7 @@ E('ERR_ENCODING_NOT_SUPPORTED', 'The "%s" encoding is not supported',
|
||||
E('ERR_FALSY_VALUE_REJECTION', 'Promise was rejected with falsy value', Error);
|
||||
E('ERR_FS_INVALID_SYMLINK_TYPE',
|
||||
'Symlink type must be one of "dir", "file", or "junction". Received "%s"',
|
||||
Error);
|
||||
Error); // Switch to TypeError. The current implementation does not seem right
|
||||
E('ERR_HTTP2_ALTSVC_INVALID_ORIGIN',
|
||||
'HTTP/2 ALTSVC frames require a valid origin', TypeError);
|
||||
E('ERR_HTTP2_ALTSVC_LENGTH',
|
||||
@@ -659,10 +661,14 @@ E('ERR_HTTP2_GOAWAY_SESSION',
|
||||
E('ERR_HTTP2_HEADERS_AFTER_RESPOND',
|
||||
'Cannot specify additional headers after response initiated', Error);
|
||||
E('ERR_HTTP2_HEADERS_SENT', 'Response has already been initiated.', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_HTTP2_HEADER_SINGLE_VALUE',
|
||||
'Header field "%s" must have only a single value', Error);
|
||||
E('ERR_HTTP2_INFO_STATUS_NOT_ALLOWED',
|
||||
'Informational status codes cannot be used', RangeError);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_HTTP2_INVALID_CONNECTION_HEADERS',
|
||||
'HTTP/1 Connection specific headers are forbidden: "%s"', Error);
|
||||
E('ERR_HTTP2_INVALID_HEADER_VALUE',
|
||||
@@ -671,6 +677,8 @@ E('ERR_HTTP2_INVALID_INFO_STATUS',
|
||||
'Invalid informational status code: %s', RangeError);
|
||||
E('ERR_HTTP2_INVALID_PACKED_SETTINGS_LENGTH',
|
||||
'Packed settings length must be a multiple of six', RangeError);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_HTTP2_INVALID_PSEUDOHEADER',
|
||||
'"%s" is an invalid pseudoheader or is used incorrectly', Error);
|
||||
E('ERR_HTTP2_INVALID_SESSION', 'The session has been destroyed', Error);
|
||||
@@ -689,6 +697,8 @@ E('ERR_HTTP2_PAYLOAD_FORBIDDEN',
|
||||
'Responses with %s status must not have a payload', Error);
|
||||
E('ERR_HTTP2_PING_CANCEL', 'HTTP2 ping cancelled', Error);
|
||||
E('ERR_HTTP2_PING_LENGTH', 'HTTP2 ping payload must be 8 bytes', RangeError);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_HTTP2_PSEUDOHEADER_NOT_ALLOWED',
|
||||
'Cannot set HTTP/2 pseudo-headers', Error);
|
||||
E('ERR_HTTP2_PUSH_DISABLED', 'HTTP/2 client has disabled push streams', Error);
|
||||
@@ -736,8 +746,12 @@ E('ERR_INVALID_BUFFER_SIZE',
|
||||
'Buffer size must be a multiple of %s', RangeError);
|
||||
E('ERR_INVALID_CALLBACK', 'Callback must be a function', TypeError);
|
||||
E('ERR_INVALID_CHAR', invalidChar, TypeError); //Check falsy "Error" entries.
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_CURSOR_POS',
|
||||
'Cannot set cursor row without setting its column', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_DOMAIN_NAME', 'Unable to determine the domain name', Error);
|
||||
E('ERR_INVALID_FD',
|
||||
'"fd" must be a positive integer: %s', RangeError);
|
||||
@@ -747,6 +761,7 @@ E('ERR_INVALID_FILE_URL_HOST',
|
||||
E('ERR_INVALID_FILE_URL_PATH', 'File URL path %s', TypeError);
|
||||
E('ERR_INVALID_HANDLE_TYPE', 'This handle type cannot be sent', TypeError);
|
||||
E('ERR_INVALID_HTTP_TOKEN', '%s must be a valid HTTP token ["%s"]', TypeError);
|
||||
// The `Error` should probably be a `TypeError`.
|
||||
E('ERR_INVALID_IP_ADDRESS', 'Invalid IP address: %s', TypeError, Error);
|
||||
E('ERR_INVALID_OPT_VALUE', (name, value) =>
|
||||
`The value "${String(value)}" is invalid for option "${name}"`,
|
||||
@@ -756,7 +771,11 @@ E('ERR_INVALID_OPT_VALUE_ENCODING',
|
||||
'The value "%s" is invalid for option "encoding"', TypeError);
|
||||
E('ERR_INVALID_PERFORMANCE_MARK',
|
||||
'The "%s" performance mark has not been set', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_PROTOCOL', 'Protocol "%s" not supported. Expected "%s"', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_INVALID_REPL_EVAL_CONFIG',
|
||||
'Cannot specify both "breakEvalOnSigint" and "eval" for REPL', Error);
|
||||
E('ERR_INVALID_SYNC_FORK_INPUT',
|
||||
@@ -829,6 +848,8 @@ E('ERR_TLS_DH_PARAM_SIZE', 'DH parameter size %s is less than 2048', Error);
|
||||
E('ERR_TLS_HANDSHAKE_TIMEOUT', 'TLS handshake timeout', Error);
|
||||
E('ERR_TLS_RENEGOTIATION_DISABLED',
|
||||
'TLS session renegotiation disabled for this socket', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_TLS_REQUIRED_SERVER_NAME',
|
||||
'"servername" is required parameter for Server.addContext', Error);
|
||||
E('ERR_TLS_SESSION_ATTACK', 'TLS session renegotiation attack detected', Error);
|
||||
@@ -836,6 +857,8 @@ E('ERR_TLS_SNI_FROM_SERVER',
|
||||
'Cannot issue SNI from a TLS server-side socket', Error);
|
||||
E('ERR_TRANSFORM_ALREADY_TRANSFORMING',
|
||||
'Calling transform done when still transforming', Error);
|
||||
|
||||
// This should probably be a `RangeError`.
|
||||
E('ERR_TRANSFORM_WITH_LENGTH_0',
|
||||
'Calling transform done when writableState.length != 0', Error);
|
||||
E('ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET',
|
||||
@@ -850,14 +873,20 @@ E('ERR_UNHANDLED_ERROR',
|
||||
return `${msg} (${err})`;
|
||||
}, Error);
|
||||
E('ERR_UNKNOWN_ENCODING', 'Unknown encoding: %s', TypeError);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension: %s', Error);
|
||||
E('ERR_UNKNOWN_MODULE_FORMAT', 'Unknown module format: %s', RangeError);
|
||||
E('ERR_UNKNOWN_SIGNAL', 'Unknown signal: %s', TypeError);
|
||||
E('ERR_UNKNOWN_STDIN_TYPE', 'Unknown stdin file type', Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_UNKNOWN_STREAM_TYPE', 'Unknown stream file type', Error);
|
||||
E('ERR_V8BREAKITERATOR',
|
||||
'Full ICU data not installed. See https://github.com/nodejs/node/wiki/Intl',
|
||||
Error);
|
||||
|
||||
// This should probably be a `TypeError`.
|
||||
E('ERR_VALID_PERFORMANCE_ENTRY_TYPE',
|
||||
'At least one valid performance entry type is required', Error);
|
||||
E('ERR_VM_MODULE_ALREADY_LINKED', 'Module has already been linked', Error);
|
||||
|
||||
Reference in New Issue
Block a user