Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc,errors: add extends to derived classes #29303

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ lenient legacy mode.

## Class: assert.AssertionError

A subclass of `Error` that indicates the failure of an assertion. All errors
thrown by the `assert` module will be instances of the `AssertionError` class.
* Extends: {errors.Error}

Indicates the failure of an assertion. All errors thrown by the `assert` module
will be instances of the `AssertionError` class.

### new assert.AssertionError(options)
<!-- YAML
Expand Down
45 changes: 28 additions & 17 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ cases. If [domains][] are enabled, or a handler has been registered with

<!--type=class-->

A generic JavaScript `Error` object that does not denote any specific
A generic JavaScript {Error} object that does not denote any specific
circumstance of why the error occurred. `Error` objects capture a "stack trace"
detailing the point in the code at which the `Error` was instantiated, and may
provide a text description of the error.
Expand Down Expand Up @@ -352,14 +352,18 @@ loop tick.

## Class: AssertionError

A subclass of `Error` that indicates the failure of an assertion. For details,
see [`Class: assert.AssertionError`][].
* Extends: {errors.Error}

Indicates the failure of an assertion. For details, see
[`Class: assert.AssertionError`][].

## Class: RangeError

A subclass of `Error` that indicates that a provided argument was not within the
set or range of acceptable values for a function; whether that is a numeric
range, or outside the set of options for a given function parameter.
* Extends: {errors.Error}

Indicates that a provided argument was not within the set or range of
acceptable values for a function; whether that is a numeric range, or
outside the set of options for a given function parameter.

```js
require('net').connect(-1);
Expand All @@ -371,9 +375,11 @@ of argument validation.

## Class: ReferenceError

A subclass of `Error` that indicates that an attempt is being made to access a
variable that is not defined. Such errors commonly indicate typos in code, or
an otherwise broken program.
* Extends: {errors.Error}

Indicates that an attempt is being made to access a variable that is not
defined. Such errors commonly indicate typos in code, or an otherwise broken
program.

While client code may generate and propagate these errors, in practice, only V8
will do so.
Expand All @@ -389,11 +395,12 @@ or its dependencies.

## Class: SyntaxError

A subclass of `Error` that indicates that a program is not valid JavaScript.
These errors may only be generated and propagated as a result of code
evaluation. Code evaluation may happen as a result of `eval`, `Function`,
`require`, or [vm][]. These errors are almost always indicative of a broken
program.
* Extends: {errors.Error}

Indicates that a program is not valid JavaScript. These errors may only be
generated and propagated as a result of code evaluation. Code evaluation may
happen as a result of `eval`, `Function`, `require`, or [vm][]. These errors
are almost always indicative of a broken program.

```js
try {
Expand All @@ -408,6 +415,8 @@ they may only be caught by other contexts.

## Class: SystemError

* Extends: {errors.Error}

Node.js generates system errors when exceptions occur within its runtime
environment. These usually occur when an application violates an operating
system constraint. For example, a system error will occur if an application
Expand Down Expand Up @@ -550,9 +559,11 @@ program. For a comprehensive list, see the [`errno`(3) man page][].

## Class: TypeError

A subclass of `Error` that indicates that a provided argument is not an
allowable type. For example, passing a function to a parameter which expects a
string would be considered a `TypeError`.
* Extends {errors.Error}

Indicates that a provided argument is not an allowable type. For example,
passing a function to a parameter which expects a string would be considered
a `TypeError`.

```js
require('url').parse(() => { });
Expand Down
2 changes: 2 additions & 0 deletions tools/doc/type-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ const customTypesMap = {

'Domain': 'domain.html#domain_class_domain',

'errors.Error': 'errors.html#errors_class_error',

'import.meta': 'esm.html#esm_import_meta',

'EventEmitter': 'events.html#events_class_eventemitter',
Expand Down