Skip to content

Commit f1b7e8d

Browse files
vsemozhetbytaddaleax
authored andcommitted
doc: fix nits in guides/using-internal-errors.md
PR-URL: #13820 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: David Cai <[email protected]>
1 parent b15378c commit f1b7e8d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

doc/guides/using-internal-errors.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ are intended to replace existing `Error` objects within the Node.js source.
2727
For instance, an existing `Error` such as:
2828

2929
```js
30-
const err = new TypeError('Expected string received ' + type);
30+
const err = new TypeError(`Expected string received ${type}`);
3131
```
3232

3333
Can be replaced by first adding a new error key into the `internal/errors.js`
@@ -40,9 +40,9 @@ E('FOO', 'Expected string received %s');
4040
Then replacing the existing `new TypeError` in the code:
4141

4242
```js
43-
const errors = require('internal/errors');
44-
// ...
45-
const err = new errors.TypeError('FOO', type);
43+
const errors = require('internal/errors');
44+
// ...
45+
const err = new errors.TypeError('FOO', type);
4646
```
4747

4848
## Adding new errors
@@ -90,7 +90,7 @@ The specific error message for the `myError` instance will depend on the
9090
associated value of `KEY` (see "Adding new errors").
9191

9292
The `myError` object will have a `code` property equal to the `key` and a
93-
`name` property equal to `Error[${key}]`.
93+
`name` property equal to `` `Error [${key}]` ``.
9494

9595
### Class: errors.TypeError(key[, args...])
9696

@@ -110,7 +110,7 @@ The specific error message for the `myError` instance will depend on the
110110
associated value of `KEY` (see "Adding new errors").
111111

112112
The `myError` object will have a `code` property equal to the `key` and a
113-
`name` property equal to `TypeError[${key}]`.
113+
`name` property equal to `` `TypeError [${key}]` ``.
114114

115115
### Class: errors.RangeError(key[, args...])
116116

@@ -130,7 +130,7 @@ The specific error message for the `myError` instance will depend on the
130130
associated value of `KEY` (see "Adding new errors").
131131

132132
The `myError` object will have a `code` property equal to the `key` and a
133-
`name` property equal to `RangeError[${key}]`.
133+
`name` property equal to `` `RangeError [${key}]` ``.
134134

135135
### Method: errors.message(key, args)
136136

0 commit comments

Comments
 (0)