Skip to content

Commit d6619b9

Browse files
gnbezerragibfahn
authored andcommitted
doc: document missing error codes
There are discrepancies between the errors defined in `lib/internal/errors.js` and those documented in `doc/api/errors.md`. Some of the errors recently defined are not documented, while others were removed, but still have entries in the docs. This commit fills in those gaps in the documentation. PR-URL: #15160 Backport-PR-URL: #16556 Fixes: #15038 Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 96e8250 commit d6619b9

File tree

1 file changed

+129
-17
lines changed

1 file changed

+129
-17
lines changed

doc/api/errors.md

+129-17
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,30 @@ found [here][online].
586586
Used generically to identify that an iterable argument (i.e. a value that works
587587
with `for...of` loops) is required, but not provided to a Node.js API.
588588

589+
<a id="ERR_ASYNC_CALLBACK"></a>
590+
### ERR_ASYNC_CALLBACK
591+
592+
Used with `AsyncHooks` to indicate an attempt of registering something that is
593+
not a function as a callback.
594+
595+
<a id="ERR_ASYNC_TYPE"></a>
596+
### ERR_ASYNC_TYPE
597+
598+
Used when the type of an asynchronous resource is invalid. Note that users are
599+
also able to define their own types when using the public embedder API.
600+
601+
<a id="ERR_ENCODING_INVALID_ENCODED_DATA"></a>
602+
### ERR_ENCODING_INVALID_ENCODED_DATA
603+
604+
Used by the `util.TextDecoder()` API when the data provided is invalid
605+
according to the encoding provided.
606+
607+
<a id="ERR_ENCODING_NOT_SUPPORTED"></a>
608+
### ERR_ENCODING_NOT_SUPPORTED
609+
610+
Used by the `util.TextDecoder()` API when the encoding provided is not one of
611+
the [WHATWG Supported Encodings][].
612+
589613
<a id="ERR_FALSY_VALUE_REJECTION"></a>
590614
### ERR_FALSY_VALUE_REJECTION
591615

@@ -598,6 +622,12 @@ with a falsy value (e.g. `null`).
598622
Used when headers have already been sent and another attempt is made to add
599623
more headers.
600624

625+
<a id="ERR_HTTP_INVALID_CHAR"></a>
626+
### ERR_HTTP_INVALID_CHAR
627+
628+
Used when an invalid character is found in an HTTP response status message
629+
(reason phrase).
630+
601631
<a id="ERR_HTTP_INVALID_STATUS_CODE"></a>
602632
### ERR_HTTP_INVALID_STATUS_CODE
603633

@@ -624,20 +654,32 @@ forbidden.
624654
<a id="ERR_HTTP2_CONNECT_SCHEME"></a>
625655
### ERR_HTTP2_CONNECT_SCHEME
626656

627-
The HTTP/2 requests using the `CONNECT` method, the `:scheme` pseudo-header is
657+
For HTTP/2 requests using the `CONNECT` method, the `:scheme` pseudo-header is
628658
forbidden.
629659

630-
<a id="ERR_HTTP2_ERROR"></a>
631-
### ERR_HTTP2_ERROR
632-
633-
A non-specific HTTP/2 error has occurred.
634-
635660
<a id="ERR_HTTP2_FRAME_ERROR"></a>
636661
### ERR_HTTP2_FRAME_ERROR
637662

638663
Used when a failure occurs sending an individual frame on the HTTP/2
639664
session.
640665

666+
<a id="ERR_HTTP2_HEADER_REQUIRED"></a>
667+
### ERR_HTTP2_HEADER_REQUIRED
668+
669+
Used when a required header is missing in an HTTP/2 message.
670+
671+
<a id="ERR_HTTP2_HEADER_SINGLE_VALUE"></a>
672+
### ERR_HTTP2_HEADER_SINGLE_VALUE
673+
674+
Used when multiple values have been provided for an HTTP header field that
675+
required to have only a single value.
676+
677+
<a id="ERR_HTTP2_HEADERS_AFTER_RESPOND"></a>
678+
### ERR_HTTP2_HEADERS_AFTER_RESPOND
679+
680+
Used when trying to specify additional headers after an HTTP/2 response
681+
initiated.
682+
641683
<a id="ERR_HTTP2_HEADERS_OBJECT"></a>
642684
### ERR_HTTP2_HEADERS_OBJECT
643685

@@ -648,12 +690,6 @@ Used when an HTTP/2 Headers Object is expected.
648690

649691
Used when an attempt is made to send multiple response headers.
650692

651-
<a id="ERR_HTTP2_HEADER_SINGLE_VALUE"></a>
652-
### ERR_HTTP2_HEADER_SINGLE_VALUE
653-
654-
Used when multiple values have been provided for an HTTP header field that
655-
required to have only a single value.
656-
657693
<a id="ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND"></a>
658694
### ERR_HTTP2_INFO_HEADERS_AFTER_RESPOND
659695

@@ -811,6 +847,12 @@ Used when a given index is out of the accepted range (e.g. negative offsets).
811847
Used generically to identify that an argument of the wrong type has been passed
812848
to a Node.js API.
813849

850+
<a id="ERR_INVALID_ASYNC_ID"></a>
851+
### ERR_INVALID_ASYNC_ID
852+
853+
Used with `AsyncHooks` when an invalid `asyncId` or `triggerAsyncId` is passed.
854+
An id less than -1 should never happen.
855+
814856
<a id="ERR_INVALID_CALLBACK"></a>
815857
### ERR_INVALID_CALLBACK
816858

@@ -846,6 +888,12 @@ communication channel to a child process. See [`subprocess.send()`] and
846888
Used generically to identify when an invalid or unexpected value has been
847889
passed in an options object.
848890

891+
<a id="ERR_INVALID_PERFORMANCE_MARK"></a>
892+
### ERR_INVALID_PERFORMANCE_MARK
893+
894+
Used by the Performance Timing API (`perf_hooks`) when a performance mark is
895+
invalid.
896+
849897
<a id="ERR_INVALID_PROTOCOL"></a>
850898
### ERR_INVALID_PROTOCOL
851899

@@ -935,12 +983,28 @@ only used in the [WHATWG URL API][] for strict compliance with the specification
935983
native Node.js APIs, `func(undefined)` and `func()` are treated identically, and
936984
the [`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
937985

986+
<a id="ERR_NAPI_CONS_FUNCTION"></a>
987+
### ERR_NAPI_CONS_FUNCTION
988+
989+
Used by the `N-API` when a constructor passed is not a function.
990+
991+
<a id="ERR_NAPI_CONS_PROTOTYPE_OBJECT"></a>
992+
### ERR_NAPI_CONS_PROTOTYPE_OBJECT
993+
994+
Used by the `N-API` when `Constructor.prototype` is not an object.
995+
938996
<a id="ERR_NO_ICU"></a>
939997
### ERR_NO_ICU
940998

941999
Used when an attempt is made to use features that require [ICU][], while
9421000
Node.js is not compiled with ICU support.
9431001

1002+
<a id="ERR_OUTOFMEMORY"></a>
1003+
### ERR_OUTOFMEMORY
1004+
1005+
Used generically to identify that an operation caused an out of memory
1006+
condition.
1007+
9441008
<a id="ERR_SOCKET_ALREADY_BOUND"></a>
9451009
### ERR_SOCKET_ALREADY_BOUND
9461010
Used when an attempt is made to bind a socket that has already been bound.
@@ -962,6 +1026,11 @@ invalid value.
9621026

9631027
Used when data cannot be sent on a socket.
9641028

1029+
<a id="ERR_SOCKET_CLOSED"></a>
1030+
### ERR_SOCKET_CLOSED
1031+
1032+
Used when an attempt is made to operate on an already closed socket.
1033+
9651034
<a id="ERR_SOCKET_DGRAM_NOT_RUNNING"></a>
9661035
### ERR_SOCKET_DGRAM_NOT_RUNNING
9671036

@@ -979,12 +1048,54 @@ Node.js does not allow `stdout` or `stderr` Streams to be closed by user code.
9791048
Used when an attempt is made to close the `process.stdout` stream. By design,
9801049
Node.js does not allow `stdout` or `stderr` Streams to be closed by user code.
9811050

982-
<a id="ERR_UNKNOWN_BUILTIN_MODULE"></a>
983-
### ERR_UNKNOWN_BUILTIN_MODULE
1051+
<a id="ERR_TLS_CERT_ALTNAME_INVALID"></a>
1052+
### ERR_TLS_CERT_ALTNAME_INVALID
1053+
1054+
Used with TLS, when the hostname/IP of the peer does not match any of the
1055+
subjectAltNames in its certificate.
1056+
1057+
<a id="ERR_TLS_DH_PARAM_SIZE"></a>
1058+
### ERR_TLS_DH_PARAM_SIZE
1059+
1060+
Used with TLS when the parameter offered for the Diffie-Hellman (`DH`)
1061+
key-agreement protocol is too small. By default, the key length must be greater
1062+
than or equal to 1024 bits to avoid vulnerabilities, even though it is strongly
1063+
recommended to use 2048 bits or larger for stronger security.
1064+
1065+
<a id="ERR_TLS_HANDSHAKE_TIMEOUT"></a>
1066+
### ERR_TLS_HANDSHAKE_TIMEOUT
1067+
1068+
A TLS error emitted by the server whenever a TLS/SSL handshake times out. In
1069+
this case, the server must also abort the connection.
1070+
1071+
<a id="ERR_TLS_RENEGOTIATION_FAILED"></a>
1072+
### ERR_TLS_RENEGOTIATION_FAILED
1073+
1074+
Used when a TLS renegotiation request has failed in a non-specific way.
1075+
1076+
<a id="ERR_TLS_REQUIRED_SERVER_NAME"></a>
1077+
### ERR_TLS_REQUIRED_SERVER_NAME
1078+
1079+
Used with TLS, when calling the `server.addContext()` method without providing
1080+
a hostname in the first parameter.
1081+
1082+
<a id="ERR_TLS_SESSION_ATTACK"></a>
1083+
### ERR_TLS_SESSION_ATTACK
1084+
1085+
Used when an excessive amount of TLS renegotiations is detected, which is a
1086+
potential vector for denial-of-service attacks.
1087+
1088+
<a id="ERR_TRANSFORM_ALREADY_TRANSFORMING"></a>
1089+
### ERR_TRANSFORM_ALREADY_TRANSFORMING
1090+
1091+
Used in Transform streams when the stream finishes while it is still
1092+
transforming.
1093+
1094+
<a id="ERR_TRANSFORM_WITH_LENGTH_0"></a>
1095+
### ERR_TRANSFORM_WITH_LENGTH_0
9841096

985-
Used to identify a specific kind of internal Node.js error that should not
986-
typically be triggered by user code. Instances of this error point to an
987-
internal bug within the Node.js binary itself.
1097+
Used in Transform streams when the stream finishes with data still in the write
1098+
buffer.
9881099

9891100
<a id="ERR_UNKNOWN_SIGNAL"></a>
9901101
### ERR_UNKNOWN_SIGNAL
@@ -1052,3 +1163,4 @@ Used when a given value is out of the accepted range.
10521163
[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html
10531164
[try-catch]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/try...catch
10541165
[vm]: vm.html
1166+
[WHATWG Supported Encodings]: util.md#whatwg-supported-encodings

0 commit comments

Comments
 (0)