doc: fix section sorting, add link reference · nodejs/node@10eaf6a (original) (raw)

`@@ -407,34 +407,6 @@ try {

`

407

407

`` SyntaxError instances are unrecoverable in the context that created them –

``

408

408

`they may only be caught by other contexts.

`

409

409

``

410

``

`-

Class: TypeError

`

411

``

-

412

``

`` -

A subclass of Error that indicates that a provided argument is not an

``

413

``

`-

allowable type. For example, passing a function to a parameter which expects a

`

414

``

`` -

string would be considered a TypeError.

``

415

``

-

416

``


```js

417

``

`-

require('url').parse(() => { });

`

418

``

`-

// Throws TypeError, since it expected a string.

`

419

``


```

420

``

-

421

``

`` -

Node.js will generate and throw TypeError instances immediately as a form

``

422

``

`-

of argument validation.

`

423

``

-

424

``

`-

Exceptions vs. Errors

`

425

``

-

426

``

`-

`

427

``

-

428

``

`-

A JavaScript exception is a value that is thrown as a result of an invalid

`

429

``

`` -

operation or as the target of a throw statement. While it is not required

``

430

``

`` -

that these values are instances of Error or classes which inherit from

``

431

``

`` -

Error, all exceptions thrown by Node.js or the JavaScript runtime will be

``

432

``

`` -

instances of Error.

``

433

``

-

434

``

`-

Some exceptions are unrecoverable at the JavaScript layer. Such exceptions

`

435

``

`` -

will always cause the Node.js process to crash. Examples include assert()

``

436

``

`` -

checks or abort() calls in the C++ layer.

``

437

``

-

438

410

`## Class: SystemError

`

439

411

``

440

412

`Node.js generates system errors when exceptions occur within its runtime

`

`` @@ -575,6 +547,34 @@ program. For a comprehensive list, see the [errno(3) man page][].

``

575

547

`` encountered by [http][] or [net][] — often a sign that a socket.end()

``

576

548

` was not properly called.

`

577

549

``

``

550

`+

Class: TypeError

`

``

551

+

``

552

`` +

A subclass of Error that indicates that a provided argument is not an

``

``

553

`+

allowable type. For example, passing a function to a parameter which expects a

`

``

554

`` +

string would be considered a TypeError.

``

``

555

+

``

556


```js

``

557

`+

require('url').parse(() => { });

`

``

558

`+

// Throws TypeError, since it expected a string.

`

``

559


```

``

560

+

``

561

`` +

Node.js will generate and throw TypeError instances immediately as a form

``

``

562

`+

of argument validation.

`

``

563

+

``

564

`+

Exceptions vs. Errors

`

``

565

+

``

566

`+

`

``

567

+

``

568

`+

A JavaScript exception is a value that is thrown as a result of an invalid

`

``

569

`` +

operation or as the target of a throw statement. While it is not required

``

``

570

`` +

that these values are instances of Error or classes which inherit from

``

``

571

`` +

Error, all exceptions thrown by Node.js or the JavaScript runtime will be

``

``

572

`` +

instances of Error.

``

``

573

+

``

574

`+

Some exceptions are unrecoverable at the JavaScript layer. Such exceptions

`

``

575

`` +

will always cause the Node.js process to crash. Examples include assert()

``

``

576

`` +

checks or abort() calls in the C++ layer.

``

``

577

+

578

578

`## OpenSSL Errors

`

579

579

``

580

580

`` Errors originating in crypto or tls are of class Error, and in addition to

``