From 229748c756f7b6eaa79b4d861e39d6a57cc01b36 Mon Sep 17 00:00:00 2001 From: jklepatch Date: Mon, 12 Jun 2017 13:14:09 +0800 Subject: [PATCH] doc: removed redundant mentions to error codes PR-URL: https://github.com/nodejs/node/pull/13627 Backport-PR-URL: https://github.com/nodejs/node/pull/14175 Reviewed-By: Refael Ackermann Reviewed-By: Timothy Gu Reviewed-By: Gibson Fahnestock --- doc/api/errors.md | 170 +++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 94 deletions(-) diff --git a/doc/api/errors.md b/doc/api/errors.md index 88d3b1f6c79b15..97d3ec70ea2ae7 100644 --- a/doc/api/errors.md +++ b/doc/api/errors.md @@ -567,9 +567,8 @@ found [here][online]. ### ERR_ARG_NOT_ITERABLE -The `'ERR_ARG_NOT_ITERABLE'` error code is used generically to identify that an -iterable argument (i.e. a value that works with `for...of` loops) is required, -but not provided to a Node.js API. +Used generically to identify that an iterable argument (i.e. a value that works +with `for...of` loops) is required, but not provided to a Node.js API. ### ERR_FALSY_VALUE_REJECTION @@ -580,58 +579,56 @@ with a falsy value (e.g. `null`). ### ERR_INVALID_ARG_TYPE -The `'ERR_INVALID_ARG_TYPE'` error code is used generically to identify that -an argument of the wrong type has been passed to a Node.js API. +Used generically to identify that an argument of the wrong type has been passed +to a Node.js API. ### ERR_INVALID_CALLBACK -The `'ERR_INVALID_CALLBACK'` error code is used generically to identify that -a callback function is required and has not been provided to a Node.js API. +Used generically to identify that a callback function is required and has not +been provided to a Node.js API. ### ERR_INVALID_FILE_URL_HOST -An error with the `'ERR_INVALID_FILE_URL_HOST'` code may be thrown when a -Node.js API that consumes `file:` URLs (such as certain functions in the -[`fs`][] module) encounters a file URL with an incompatible host. Currently, -this situation can only occur on Unix-like systems, where only `localhost` or -an empty host is supported. +Used when a Node.js API that consumes `file:` URLs (such as certain functions in +the [`fs`][] module) encounters a file URL with an incompatible host. Currently, +this situation can only occur on Unix-like systems, where only `localhost` or an +empty host is supported. ### ERR_INVALID_FILE_URL_PATH -An error with the `'ERR_INVALID_FILE_URL_PATH'` code may be thrown when a -Node.js API that consumes `file:` URLs (such as certain functions in the -[`fs`][] module) encounters a file URL with an incompatible path. The exact -semantics for determining whether a path can be used is platform-dependent. +Used when a Node.js API that consumes `file:` URLs (such as certain +functions in the [`fs`][] module) encounters a file URL with an incompatible +path. The exact semantics for determining whether a path can be used is +platform-dependent. ### ERR_INVALID_HANDLE_TYPE -The '`ERR_INVALID_HANDLE_TYPE`' error code is used when an attempt is made to -send an unsupported "handle" over an IPC communication channel to a child -process. See [`child.send()`] and [`process.send()`] for more information. +Used when an attempt is made to send an unsupported "handle" over an IPC +communication channel to a child process. See [`child.send()`] and +[`process.send()`] for more information. ### ERR_INVALID_OPT_VALUE -The `'ERR_INVALID_OPT_VALUE'` error code is used generically to identify when -an invalid or unexpected value has been passed in an options object. +Used generically to identify when an invalid or unexpected value has been +passed in an options object. ### ERR_INVALID_SYNC_FORK_INPUT -The `'ERR_INVALID_SYNC_FORK_INPUT'` error code is used when a `Buffer`, -`Uint8Array` or `string` is provided as stdio input to a synchronous -fork. See the documentation for the [`child_process`](child_process.html) -module for more information. +Used when a `Buffer`, `Uint8Array` or `string` is provided as stdio input to a +synchronous fork. See the documentation for the +[`child_process`](child_process.html) module for more information. ### ERR_INVALID_THIS -The `'ERR_INVALID_THIS'` error code is used generically to identify that a -Node.js API function is called with an incompatible `this` value. +Used generically to identify that a Node.js API function is called with an +incompatible `this` value. Example: @@ -647,144 +644,129 @@ urlSearchParams.has.call(buf, 'foo'); ### ERR_INVALID_TUPLE -An error with code `'ERR_INVALID_TUPLE'` is thrown when an element in the -`iterable` provided to the [WHATWG][WHATWG URL API] [`URLSearchParams` -constructor][`new URLSearchParams(iterable)`] does not represent a `[name, -value]` tuple – that is, if an element is not iterable, or does not consist of -exactly two elements. +Used when an element in the `iterable` provided to the [WHATWG][WHATWG URL +API] [`URLSearchParams`constructor][`new URLSearchParams(iterable)`] does not +represent a `[name, value]` tuple – that is, if an element is not iterable, or +does not consist of exactly two elements. ### ERR_INVALID_URL -An error using the `'ERR_INVALID_URL'` code is thrown when an invalid URL is -passed to the [WHATWG][WHATWG URL API] [`URL` constructor][`new URL(input)`] to -be parsed. The thrown error object typically has an additional property -`'input'` that contains the URL that failed to parse. +Used when an invalid URL is passed to the [WHATWG][WHATWG URL API] +[`URL` constructor][`new URL(input)`] to be parsed. The thrown error object +typically has an additional property `'input'` that contains the URL that failed +to parse. ### ERR_INVALID_URL_SCHEME -The code `'ERR_INVALID_URL_SCHEME'` is used generically to signify an attempt -to use a URL of an incompatible scheme (aka protocol) for a specific purpose. -It is currently only used in the [WHATWG URL API][] support in the [`fs`][] -module (which only accepts URLs with `'file'` scheme), but may be used in other -Node.js APIs as well in the future. +Used generically to signify an attempt to use a URL of an incompatible scheme +(aka protocol) for a specific purpose. It is currently only used in the +[WHATWG URL API][] support in the [`fs`][] module (which only accepts URLs with +`'file'` scheme), but may be used in other Node.js APIs as well in the future. ### ERR_IPC_CHANNEL_CLOSED -The `'ERR_IPC_CHANNEL_CLOSED'` error code is used when an attempt is made to use -an IPC communication channel that has already been closed. +Used when an attempt is made to use an IPC communication channel that has +already been closed. ### ERR_IPC_DISCONNECTED -The `'ERR_IPC_DISCONNECTED'` error code is used when an attempt is made to -disconnect an already disconnected IPC communication channel between two -Node.js processes. See the documentation for the -[`child_process`](child_process.html) module for more information. +Used when an attempt is made to disconnect an already disconnected IPC +communication channel between two Node.js processes. See the documentation for +the [`child_process`](child_process.html) module for more information. ### ERR_IPC_ONE_PIPE -The `'ERR_IPC_ONE_PIPE'` error code is used when an attempt is made to create -a child Node.js process using more than one IPC communication channel. -See the documentation for the [`child_process`](child_process.html) -module for more information. +Used when an attempt is made to create a child Node.js process using more than +one IPC communication channel. See the documentation for the +[`child_process`](child_process.html) module for more information. ### ERR_IPC_SYNC_FORK -The `'ERR_IPC_SYNC_FORK'` error code is used when an attempt is made to open -an IPC communication channel with a synchronous forked Node.js process. -See the documentation for the [`child_process`](child_process.html) -module for more information. +Used when an attempt is made to open an IPC communication channel with a +synchronous forked Node.js process. See the documentation for the +[`child_process`](child_process.html) module for more information. ### ERR_MISSING_ARGS -The `'ERR_MISSING_ARGS'` error code is a generic error code for instances where -a required argument of a Node.js API is not passed. This is currently only used -in the [WHATWG URL API][] for strict compliance with the specification (which -in some cases may accept `func(undefined)` but not `func()`). In most native -Node.js APIs, `func(undefined)` and `func()` are treated identically, and the -[`ERR_INVALID_ARG_TYPE`][] error code may be used instead. +Used when a required argument of a Node.js API is not passed. This is currently +only used in the [WHATWG URL API][] for strict compliance with the specification +(which in some cases may accept `func(undefined)` but not `func()`). In most +native Node.js APIs, `func(undefined)` and `func()` are treated identically, and +the [`ERR_INVALID_ARG_TYPE`][] error code may be used instead. ### ERR_SOCKET_ALREADY_BOUND -An error using the `'ERR_SOCKET_ALREADY_BOUND'` code is thrown when an attempt -is made to bind a socket that has already been bound. +Used when an attempt is made to bind a socket that has already been bound. ### ERR_SOCKET_BAD_PORT -An error using the `'ERR_SOCKET_BAD_PORT'` code is thrown when an API -function expecting a port > 0 and < 65536 receives an invalid value. +Used when an API function expecting a port > 0 and < 65536 receives an invalid +value. ### ERR_SOCKET_BAD_TYPE -An error using the `'ERR_SOCKET_BAD_TYPE'` code is thrown when an API -function expecting a socket type (`udp4` or `udp6`) receives an invalid value. +Used when an API function expecting a socket type (`udp4` or `udp6`) receives an +invalid value. ### ERR_SOCKET_CANNOT_SEND -An error using the `'ERR_SOCKET_CANNOT_SEND'` code is thrown when data -cannot be sent on a socket. +Used when data cannot be sent on a socket. ### ERR_SOCKET_DGRAM_NOT_RUNNING -An error using the `'ERR_SOCKET_DGRAM_NOT_RUNNING'` code is thrown -when a call is made and the UDP subsystem is not running. +Used when a call is made and the UDP subsystem is not running. ### ERR_STDERR_CLOSE -An error using the `'ERR_STDERR_CLOSE'` code is thrown specifically when an -attempt is made to close the `process.stderr` stream. By design, Node.js does -not allow `stdout` or `stderr` Streams to be closed by user code. +Used when an attempt is made to close the `process.stderr` stream. By design, +Node.js does not allow `stdout` or `stderr` Streams to be closed by user code. ### ERR_STDOUT_CLOSE -An error using the `'ERR_STDOUT_CLOSE'` code is thrown specifically when an -attempt is made to close the `process.stdout` stream. By design, Node.js does -not allow `stdout` or `stderr` Streams to be closed by user code. +Used when an attempt is made to close the `process.stdout` stream. By design, +Node.js does not allow `stdout` or `stderr` Streams to be closed by user code. ### ERR_UNKNOWN_BUILTIN_MODULE -The `'ERR_UNKNOWN_BUILTIN_MODULE'` error code is used to identify a specific -kind of internal Node.js error that should not typically be triggered by user -code. Instances of this error point to an internal bug within the Node.js -binary itself. +Used to identify a specific kind of internal Node.js error that should not +typically be triggered by user code. Instances of this error point to an +internal bug within the Node.js binary itself. ### ERR_UNKNOWN_SIGNAL -The `'ERR_UNKNOWN_SIGNAL`' error code is used when an invalid or unknown -process signal is passed to an API expecting a valid signal (such as -[`child.kill()`][]). +Used when an invalid or unknown process signal is passed to an API expecting a +valid signal (such as [`child.kill()`][]). ### ERR_UNKNOWN_STDIN_TYPE -An error using the `'ERR_UNKNOWN_STDIN_TYPE'` code is thrown specifically when -an attempt is made to launch a Node.js process with an unknown `stdin` file -type. Errors of this kind cannot *typically* be caused by errors in user code, -although it is not impossible. Occurrences of this error are most likely an -indication of a bug within Node.js itself. +Used when an attempt is made to launch a Node.js process with an unknown `stdin` +file type. Errors of this kind cannot *typically* be caused by errors in user +code, although it is not impossible. Occurrences of this error are most likely +an indication of a bug within Node.js itself. ### ERR_UNKNOWN_STREAM_TYPE -An error using the `'ERR_UNKNOWN_STREAM_TYPE'` code is thrown specifically when -an attempt is made to launch a Node.js process with an unknown `stdout` or -`stderr` file type. Errors of this kind cannot *typically* be caused by errors -in user code, although it is not impossible. Occurrences of this error are most -likely an indication of a bug within Node.js itself. +Used when an attempt is made to launch a Node.js process with an unknown +`stdout` or `stderr` file type. Errors of this kind cannot *typically* be caused +by errors in user code, although it is not impossible. Occurrences of this error +are most likely an indication of a bug within Node.js itself. [`ERR_INVALID_ARG_TYPE`]: #ERR_INVALID_ARG_TYPE