Skip to content

Commit 0820854

Browse files
trivikrBridgeAR
authored andcommitted
doc,errors: add extends to derived classes
PR-URL: #29303 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 6f056e5 commit 0820854

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

doc/api/assert.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ lenient legacy mode.
1010

1111
## Class: assert.AssertionError
1212

13-
A subclass of `Error` that indicates the failure of an assertion. All errors
14-
thrown by the `assert` module will be instances of the `AssertionError` class.
13+
* Extends: {errors.Error}
14+
15+
Indicates the failure of an assertion. All errors thrown by the `assert` module
16+
will be instances of the `AssertionError` class.
1517

1618
### new assert.AssertionError(options)
1719
<!-- YAML

doc/api/errors.md

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ cases. If [domains][] are enabled, or a handler has been registered with
180180

181181
<!--type=class-->
182182

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

353353
## Class: AssertionError
354354

355-
A subclass of `Error` that indicates the failure of an assertion. For details,
356-
see [`Class: assert.AssertionError`][].
355+
* Extends: {errors.Error}
356+
357+
Indicates the failure of an assertion. For details, see
358+
[`Class: assert.AssertionError`][].
357359

358360
## Class: RangeError
359361

360-
A subclass of `Error` that indicates that a provided argument was not within the
361-
set or range of acceptable values for a function; whether that is a numeric
362-
range, or outside the set of options for a given function parameter.
362+
* Extends: {errors.Error}
363+
364+
Indicates that a provided argument was not within the set or range of
365+
acceptable values for a function; whether that is a numeric range, or
366+
outside the set of options for a given function parameter.
363367

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

372376
## Class: ReferenceError
373377

374-
A subclass of `Error` that indicates that an attempt is being made to access a
375-
variable that is not defined. Such errors commonly indicate typos in code, or
376-
an otherwise broken program.
378+
* Extends: {errors.Error}
379+
380+
Indicates that an attempt is being made to access a variable that is not
381+
defined. Such errors commonly indicate typos in code, or an otherwise broken
382+
program.
377383

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

390396
## Class: SyntaxError
391397

392-
A subclass of `Error` that indicates that a program is not valid JavaScript.
393-
These errors may only be generated and propagated as a result of code
394-
evaluation. Code evaluation may happen as a result of `eval`, `Function`,
395-
`require`, or [vm][]. These errors are almost always indicative of a broken
396-
program.
398+
* Extends: {errors.Error}
399+
400+
Indicates that a program is not valid JavaScript. These errors may only be
401+
generated and propagated as a result of code evaluation. Code evaluation may
402+
happen as a result of `eval`, `Function`, `require`, or [vm][]. These errors
403+
are almost always indicative of a broken program.
397404

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

409416
## Class: SystemError
410417

418+
* Extends: {errors.Error}
419+
411420
Node.js generates system errors when exceptions occur within its runtime
412421
environment. These usually occur when an application violates an operating
413422
system constraint. For example, a system error will occur if an application
@@ -548,9 +557,11 @@ program. For a comprehensive list, see the [`errno`(3) man page][].
548557

549558
## Class: TypeError
550559

551-
A subclass of `Error` that indicates that a provided argument is not an
552-
allowable type. For example, passing a function to a parameter which expects a
553-
string would be considered a `TypeError`.
560+
* Extends {errors.Error}
561+
562+
Indicates that a provided argument is not an allowable type. For example,
563+
passing a function to a parameter which expects a string would be considered
564+
a `TypeError`.
554565

555566
```js
556567
require('url').parse(() => { });

tools/doc/type-parser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ const customTypesMap = {
6464

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

67+
'errors.Error': 'errors.html#errors_class_error',
68+
6769
'import.meta': 'esm.html#esm_import_meta',
6870

6971
'EventEmitter': 'events.html#events_class_eventemitter',

0 commit comments

Comments
 (0)