@@ -27,7 +27,7 @@ are intended to replace existing `Error` objects within the Node.js source.
27
27
For instance, an existing ` Error ` such as:
28
28
29
29
``` js
30
- const err = new TypeError (' Expected string received ' + type);
30
+ const err = new TypeError (` Expected string received ${ type} ` );
31
31
```
32
32
33
33
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');
40
40
Then replacing the existing ` new TypeError ` in the code:
41
41
42
42
``` 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);
46
46
```
47
47
48
48
## Adding new errors
@@ -90,7 +90,7 @@ The specific error message for the `myError` instance will depend on the
90
90
associated value of ` KEY ` (see "Adding new errors").
91
91
92
92
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}]` ` ` .
94
94
95
95
### Class: errors.TypeError(key[ , args...] )
96
96
@@ -110,7 +110,7 @@ The specific error message for the `myError` instance will depend on the
110
110
associated value of ` KEY ` (see "Adding new errors").
111
111
112
112
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}]` ` ` .
114
114
115
115
### Class: errors.RangeError(key[ , args...] )
116
116
@@ -130,7 +130,7 @@ The specific error message for the `myError` instance will depend on the
130
130
associated value of ` KEY ` (see "Adding new errors").
131
131
132
132
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}]` ` ` .
134
134
135
135
### Method: errors.message(key, args)
136
136
0 commit comments