Skip to content

Commit 8ca9338

Browse files
BridgeARtniessen
authored andcommitted
doc: document missing error types
PR-URL: #13857 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 50ba13e commit 8ca9338

File tree

1 file changed

+94
-12
lines changed

1 file changed

+94
-12
lines changed

doc/api/errors.md

+94-12
Original file line numberDiff line numberDiff line change
@@ -568,41 +568,85 @@ found [here][online].
568568
Used generically to identify that an iterable argument (i.e. a value that works
569569
with `for...of` loops) is required, but not provided to a Node.js API.
570570

571+
<a id="ERR_ASSERTION"></a>
572+
### ERR_ASSERTION
573+
574+
Used as special type of error that can be triggered whenever Node.js detects an
575+
exceptional logic violation that should never occur. These are raised typically
576+
by the `assert` module.
577+
571578
<a id="ERR_CONSOLE_WRITABLE_STREAM"></a>
572579
### ERR_CONSOLE_WRITABLE_STREAM
573580

574581
Used when `Console` is instantiated without `stdout` stream or when `stdout` or
575582
`stderr` streams are not writable.
576583

584+
<a id="ERR_CPU_USAGE"></a>
585+
### ERR_CPU_USAGE
586+
587+
Used when the native call from `process.cpuUsage` cannot be processed properly.
588+
577589
<a id="ERR_FALSY_VALUE_REJECTION"></a>
578590
### ERR_FALSY_VALUE_REJECTION
579591

580592
Used by the `util.callbackify()` API when a callbackified `Promise` is rejected
581593
with a falsy value (e.g. `null`).
582594

595+
<a id="ERR_HTTP_HEADERS_SENT"></a>
596+
### ERR_HTTP_HEADERS_SENT
597+
598+
Used when headers have already been sent and another attempt is made to add
599+
more headers.
600+
601+
<a id="ERR_HTTP_INVALID_STATUS_CODE"></a>
602+
### ERR_HTTP_INVALID_STATUS_CODE
603+
604+
Used for status codes outside the regular status code ranges (100-999).
605+
606+
<a id="ERR_HTTP_TRAILER_INVALID"></a>
607+
### ERR_HTTP_TRAILER_INVALID
608+
609+
Used when the `Trailer` header is set even though the transfer encoding does not
610+
support that.
611+
583612
<a id="ERR_INDEX_OUT_OF_RANGE"></a>
584613
### ERR_INDEX_OUT_OF_RANGE
585614

586-
Used when a given index is out of the accepted range.
615+
Used when a given index is out of the accepted range (e.g. negative offsets).
587616

588617
<a id="ERR_INVALID_ARG_TYPE"></a>
589618
### ERR_INVALID_ARG_TYPE
590619

591620
Used generically to identify that an argument of the wrong type has been passed
592621
to a Node.js API.
593622

623+
<a id="ERR_INVALID_ARRAY_LENGTH"></a>
624+
### ERR_INVALID_ARRAY_LENGTH
625+
626+
Used when an Array is not of the expected length or in a valid range.
627+
594628
<a id="ERR_INVALID_CALLBACK"></a>
595629
### ERR_INVALID_CALLBACK
596630

597631
Used generically to identify that a callback function is required and has not
598632
been provided to a Node.js API.
599633

634+
<a id="ERR_INVALID_CHAR"></a>
635+
### ERR_INVALID_CHAR
636+
637+
Used when invalid characters are detected in headers.
638+
600639
<a id="ERR_INVALID_CURSOR_POS"></a>
601640
### ERR_INVALID_CURSOR_POS
602641

603642
The `'ERR_INVALID_CURSOR_POS'` is thrown specifically when a cursor on a given
604643
stream is attempted to move to a specified row without a specified column.
605644

645+
<a id="ERR_INVALID_FD"></a>
646+
### ERR_INVALID_FD
647+
648+
Used when a file descriptor ('fd') is not valid (e.g. it has a negative value).
649+
606650
<a id="ERR_INVALID_FILE_URL_HOST"></a>
607651
### ERR_INVALID_FILE_URL_HOST
608652

@@ -638,6 +682,12 @@ passed in an options object.
638682
Used when both `breakEvalOnSigint` and `eval` options are set
639683
in the REPL config, which is not supported.
640684

685+
<a id="ERR_INVALID_REPL_HISTORY"></a>
686+
### ERR_INVALID_REPL_HISTORY
687+
688+
Used in the `repl` in case the old history file is used and an error occurred
689+
while trying to read and parse it.
690+
641691
<a id="ERR_INVALID_SYNC_FORK_INPUT"></a>
642692
### ERR_INVALID_SYNC_FORK_INPUT
643693

@@ -716,14 +766,33 @@ synchronous forked Node.js process. See the documentation for the
716766
<a id="ERR_MISSING_ARGS"></a>
717767
### ERR_MISSING_ARGS
718768

719-
Used when a required argument of a Node.js API is not passed. This is currently
720-
only used in the [WHATWG URL API][] for strict compliance with the specification
721-
(which in some cases may accept `func(undefined)` but not `func()`). In most
722-
native Node.js APIs, `func(undefined)` and `func()` are treated identically, and
723-
the [`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
769+
Used when a required argument of a Node.js API is not passed. This is only used
770+
for strict compliance with the API specification (which in some cases may accept
771+
`func(undefined)` but not `func()`). In most native Node.js APIs,
772+
`func(undefined)` and `func()` are treated identically, and the
773+
[`ERR_INVALID_ARG_TYPE`][] error code may be used instead.
774+
775+
<a id="ERR_MULTIPLE_CALLBACK"></a>
776+
### ERR_MULTIPLE_CALLBACK
777+
778+
Used when a callback is called more then once.
779+
780+
*Note*: A callback is almost always meant to only be called once as the query
781+
can either be fulfilled or rejected but not both at the same time. The latter
782+
would be possible by calling a callback more then once.
783+
784+
<a id="ERR_NO_CRYPTO"></a>
785+
### ERR_NO_CRYPTO
786+
787+
Used when an attempt is made to use crypto features while Node.js is not
788+
compiled with OpenSSL crypto support.
789+
790+
<a id="ERR_PARSE_HISTORY_DATA"></a>
791+
### ERR_PARSE_HISTORY_DATA
724792

725793
<a id="ERR_SOCKET_ALREADY_BOUND"></a>
726794
### ERR_SOCKET_ALREADY_BOUND
795+
727796
Used when an attempt is made to bind a socket that has already been bound.
728797

729798
<a id="ERR_SOCKET_BAD_PORT"></a>
@@ -748,12 +817,6 @@ Used when data cannot be sent on a socket.
748817

749818
Used when a call is made and the UDP subsystem is not running.
750819

751-
<a id="ERR_NO_CRYPTO"></a>
752-
### ERR_NO_CRYPTO
753-
754-
Used when an attempt is made to use crypto features while Node.js is not
755-
compiled with OpenSSL crypto support.
756-
757820
<a id="ERR_STDERR_CLOSE"></a>
758821
### ERR_STDERR_CLOSE
759822

@@ -766,6 +829,19 @@ Node.js does not allow `stdout` or `stderr` Streams to be closed by user code.
766829
Used when an attempt is made to close the `process.stdout` stream. By design,
767830
Node.js does not allow `stdout` or `stderr` Streams to be closed by user code.
768831

832+
<a id="ERR_STREAM_HAS_STRINGDECODER"></a>
833+
### ERR_STREAM_HAS_STRINGDECODER
834+
835+
Used to prevent an abort if a string decoder was set on the Socket.
836+
837+
Example
838+
```js
839+
const Socket = require('net').Socket;
840+
const instance = new Socket();
841+
842+
instance.setEncoding('utf-8');
843+
```
844+
769845
<a id="ERR_UNKNOWN_BUILTIN_MODULE"></a>
770846
### ERR_UNKNOWN_BUILTIN_MODULE
771847

@@ -795,6 +871,11 @@ Used when an attempt is made to launch a Node.js process with an unknown
795871
by errors in user code, although it is not impossible. Occurrences of this error
796872
are most likely an indication of a bug within Node.js itself.
797873

874+
<a id="ERR_V8BREAKITERATOR"></a>
875+
### ERR_V8BREAKITERATOR
876+
877+
Used when the V8 BreakIterator API is used but the full ICU data set is not
878+
installed.
798879

799880
[`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE
800881
[`child.kill()`]: child_process.html#child_process_child_kill_signal
@@ -817,6 +898,7 @@ are most likely an indication of a bug within Node.js itself.
817898
[domains]: domain.html
818899
[event emitter-based]: events.html#events_class_eventemitter
819900
[file descriptors]: https://en.wikipedia.org/wiki/File_descriptor
901+
[intl wiki]: https://github.com/nodejs/node/wiki/Intl
820902
[online]: http://man7.org/linux/man-pages/man3/errno.3.html
821903
[stream-based]: stream.html
822904
[syscall]: http://man7.org/linux/man-pages/man2/syscall.2.html

0 commit comments

Comments
 (0)