Skip to content

Commit

Permalink
lib: replace validator and error
Browse files Browse the repository at this point in the history
Refs: #41660
  • Loading branch information
VoltrexKeyva committed Jan 24, 2022
1 parent 3ee8c3e commit 90f4bdb
Show file tree
Hide file tree
Showing 77 changed files with 662 additions and 161 deletions.
65 changes: 65 additions & 0 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -2869,6 +2869,12 @@ This property is deprecated. Please use `crypto.setFips()` and

<!-- YAML
added: v15.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `candidate` {ArrayBuffer|SharedArrayBuffer|TypedArray|Buffer|DataView|bigint}
Expand Down Expand Up @@ -3547,6 +3553,12 @@ Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`

<!-- YAML
added: v15.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `type`: {string} The intended use of the generated secret key. Currently
Expand Down Expand Up @@ -3592,6 +3604,11 @@ generateKey('hmac', { length: 64 }, (err, key) => {
<!-- YAML
added: v10.12.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v16.10.0
pr-url: https://github.com/nodejs/node/pull/39927
description: Add ability to define `RSASSA-PSS-params` sequence parameters
Expand Down Expand Up @@ -3852,6 +3869,12 @@ console.log(key.export().toString('hex')); // e89..........41e

<!-- YAML
added: v15.8.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `size` {number} The size (in bits) of the prime to generate.
Expand Down Expand Up @@ -4118,6 +4141,12 @@ A convenient alias for [`crypto.webcrypto.getRandomValues()`][].

<!-- YAML
added: v15.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `digest` {string} The digest algorithm to use.
Expand Down Expand Up @@ -4221,6 +4250,11 @@ console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653'
<!-- YAML
added: v0.5.5
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35093
description: The password and salt arguments can also be ArrayBuffer
Expand Down Expand Up @@ -4602,6 +4636,11 @@ be passed instead of a public key.
<!-- YAML
added: v0.5.8
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v9.0.0
pr-url: https://github.com/nodejs/node/pull/16454
description: Passing `null` as the `callback` argument now throws
Expand Down Expand Up @@ -4782,6 +4821,11 @@ added:
- v7.10.0
- v6.13.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v9.0.0
pr-url: https://github.com/nodejs/node/pull/15231
description: The `buffer` argument may be any `TypedArray` or `DataView`.
Expand Down Expand Up @@ -4918,6 +4962,12 @@ request.
added:
- v14.10.0
- v12.19.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `min` {integer} Start of random range (inclusive). **Default:** `0`.
Expand Down Expand Up @@ -5021,6 +5071,11 @@ cryptographic pseudorandom number generator.
<!-- YAML
added: v10.5.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v15.0.0
pr-url: https://github.com/nodejs/node/pull/35093
description: The password and salt arguments can also be ArrayBuffer
Expand Down Expand Up @@ -5244,6 +5299,11 @@ Throws an error if FIPS mode is not available.
<!-- YAML
added: v12.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v15.12.0
pr-url: https://github.com/nodejs/node/pull/37500
description: Optional callback argument added.
Expand Down Expand Up @@ -5340,6 +5400,11 @@ not introduce timing vulnerabilities.
<!-- YAML
added: v12.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v15.12.0
pr-url: https://github.com/nodejs/node/pull/37500
description: Optional callback argument added.
Expand Down
90 changes: 90 additions & 0 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ section if a custom port is used.
<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v17.0.0
pr-url: https://github.com/nodejs/node/pull/39987
description: The `verbatim` options defaults to `true` now.
Expand Down Expand Up @@ -282,6 +287,12 @@ The following flags can be passed as hints to [`dns.lookup()`][].

<!-- YAML
added: v0.11.14
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `address` {string}
Expand Down Expand Up @@ -315,6 +326,12 @@ If this method is invoked as its [`util.promisify()`][]ed version, it returns a

<!-- YAML
added: v0.1.27
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string} Host name to resolve.
Expand Down Expand Up @@ -351,6 +368,11 @@ On error, `err` is an [`Error`][] object, where `err.code` is one of the
<!-- YAML
added: v0.1.16
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v7.2.0
pr-url: https://github.com/nodejs/node/pull/9296
description: This method now supports passing `options`,
Expand All @@ -377,6 +399,11 @@ will contain an array of IPv4 addresses (e.g.
<!-- YAML
added: v0.1.16
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
- version: v7.2.0
pr-url: https://github.com/nodejs/node/pull/9296
description: This method now supports passing `options`,
Expand All @@ -399,6 +426,15 @@ will contain an array of IPv6 addresses.

## `dns.resolveAny(hostname, callback)`

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
* `callback` {Function}
* `err` {Error}
Expand Down Expand Up @@ -451,6 +487,12 @@ queries. It may be better to call individual methods like [`dns.resolve4()`][],

<!-- YAML
added: v0.3.2
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand All @@ -469,6 +511,12 @@ will contain an array of canonical name records available for the `hostname`
added:
- v15.0.0
- v14.17.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand All @@ -486,6 +534,12 @@ available for the `hostname` (e.g. `[{critical: 0, iodef:

<!-- YAML
added: v0.1.27
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand All @@ -502,6 +556,12 @@ property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`).

<!-- YAML
added: v0.9.12
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand Down Expand Up @@ -537,6 +597,12 @@ function will contain an array of objects with the following properties:

<!-- YAML
added: v0.1.90
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand All @@ -553,6 +619,12 @@ contain an array of name server records available for `hostname`

<!-- YAML
added: v6.0.0
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand All @@ -568,6 +640,12 @@ be an array of strings containing the reply records.

<!-- YAML
added: v0.11.10
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand Down Expand Up @@ -605,6 +683,12 @@ be an object with the following properties:

<!-- YAML
added: v0.1.27
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

* `hostname` {string}
Expand Down Expand Up @@ -636,6 +720,12 @@ be an array of objects with the following properties:

<!-- YAML
added: v0.1.27
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/41678
description: Passing an invalid callback to the `callback` argument
now throws `ERR_INVALID_ARG_TYPE` instead of
`ERR_INVALID_CALLBACK`.
-->

<!--lint disable no-undefined-references list-item-bullet-indent-->
Expand Down
4 changes: 4 additions & 0 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,10 @@ operation.

### `ERR_INVALID_CALLBACK`

<!-- YAML
removed: REPLACEME
-->

A callback function was required but was not been provided to a Node.js API.

<a id="ERR_INVALID_CHAR"></a>
Expand Down
Loading

0 comments on commit 90f4bdb

Please sign in to comment.