@@ -93,100 +93,95 @@ common.expectsError(() => {
93
93
} ) ;
94
94
95
95
// Test ERR_INVALID_FD_TYPE
96
- assert . strictEqual ( errors . message ( 'ERR_INVALID_FD_TYPE' , [ 'a' ] ) ,
96
+ assert . strictEqual ( errors . getMessage ( 'ERR_INVALID_FD_TYPE' , [ 'a' ] ) ,
97
97
'Unsupported fd type: a' ) ;
98
98
99
99
// Test ERR_INVALID_URL_SCHEME
100
- assert . strictEqual ( errors . message ( 'ERR_INVALID_URL_SCHEME' , [ 'file' ] ) ,
100
+ assert . strictEqual ( errors . getMessage ( 'ERR_INVALID_URL_SCHEME' , [ 'file' ] ) ,
101
101
'The URL must be of scheme file' ) ;
102
- assert . strictEqual ( errors . message ( 'ERR_INVALID_URL_SCHEME' , [ [ 'file' ] ] ) ,
102
+ assert . strictEqual ( errors . getMessage ( 'ERR_INVALID_URL_SCHEME' , [ [ 'file' ] ] ) ,
103
103
'The URL must be of scheme file' ) ;
104
- assert . strictEqual ( errors . message ( 'ERR_INVALID_URL_SCHEME' , [ [ 'http' , 'ftp' ] ] ) ,
104
+ assert . strictEqual ( errors . getMessage ( 'ERR_INVALID_URL_SCHEME' ,
105
+ [ [ 'http' , 'ftp' ] ] ) ,
105
106
'The URL must be one of scheme http or ftp' ) ;
106
- assert . strictEqual ( errors . message ( 'ERR_INVALID_URL_SCHEME' , [ [ 'a' , 'b' , 'c' ] ] ) ,
107
+ assert . strictEqual ( errors . getMessage ( 'ERR_INVALID_URL_SCHEME' ,
108
+ [ [ 'a' , 'b' , 'c' ] ] ) ,
107
109
'The URL must be one of scheme a, b, or c' ) ;
108
110
common . expectsError (
109
- ( ) => errors . message ( 'ERR_INVALID_URL_SCHEME' , [ [ ] ] ) ,
111
+ ( ) => errors . getMessage ( 'ERR_INVALID_URL_SCHEME' , [ [ ] ] ) ,
110
112
{
111
113
code : 'ERR_ASSERTION' ,
112
114
type : assert . AssertionError ,
113
115
message : / ^ A t l e a s t o n e e x p e c t e d v a l u e n e e d s t o b e s p e c i f i e d $ /
114
116
} ) ;
115
117
116
118
// Test ERR_MISSING_ARGS
117
- assert . strictEqual ( errors . message ( 'ERR_MISSING_ARGS' , [ 'name' ] ) ,
119
+ assert . strictEqual ( errors . getMessage ( 'ERR_MISSING_ARGS' , [ 'name' ] ) ,
118
120
'The "name" argument must be specified' ) ;
119
- assert . strictEqual ( errors . message ( 'ERR_MISSING_ARGS' , [ 'name' , 'value' ] ) ,
121
+ assert . strictEqual ( errors . getMessage ( 'ERR_MISSING_ARGS' , [ 'name' , 'value' ] ) ,
120
122
'The "name" and "value" arguments must be specified' ) ;
121
- assert . strictEqual ( errors . message ( 'ERR_MISSING_ARGS' , [ 'a' , 'b' , 'c' ] ) ,
123
+ assert . strictEqual ( errors . getMessage ( 'ERR_MISSING_ARGS' , [ 'a' , 'b' , 'c' ] ) ,
122
124
'The "a", "b", and "c" arguments must be specified' ) ;
123
- common . expectsError (
124
- ( ) => errors . message ( 'ERR_MISSING_ARGS' ) ,
125
- {
126
- code : 'ERR_ASSERTION' ,
127
- type : assert . AssertionError ,
128
- message : / ^ A t l e a s t o n e a r g n e e d s t o b e s p e c i f i e d $ /
129
- } ) ;
130
125
131
126
// Test ERR_SOCKET_BAD_PORT
132
127
assert . strictEqual (
133
- errors . message ( 'ERR_SOCKET_BAD_PORT' , [ 0 ] ) ,
128
+ errors . getMessage ( 'ERR_SOCKET_BAD_PORT' , [ 0 ] ) ,
134
129
'Port should be > 0 and < 65536. Received 0.' ) ;
135
130
136
131
// Test ERR_TLS_CERT_ALTNAME_INVALID
137
132
assert . strictEqual (
138
- errors . message ( 'ERR_TLS_CERT_ALTNAME_INVALID' , [ 'altname' ] ) ,
133
+ errors . getMessage ( 'ERR_TLS_CERT_ALTNAME_INVALID' , [ 'altname' ] ) ,
139
134
'Hostname/IP does not match certificate\'s altnames: altname' ) ;
140
135
141
136
assert . strictEqual (
142
- errors . message ( 'ERR_INVALID_PROTOCOL' , [ 'bad protocol' , 'http' ] ) ,
137
+ errors . getMessage ( 'ERR_INVALID_PROTOCOL' , [ 'bad protocol' , 'http' ] ) ,
143
138
'Protocol "bad protocol" not supported. Expected "http"'
144
139
) ;
145
140
146
141
assert . strictEqual (
147
- errors . message ( 'ERR_HTTP_HEADERS_SENT' , [ 'render' ] ) ,
142
+ errors . getMessage ( 'ERR_HTTP_HEADERS_SENT' , [ 'render' ] ) ,
148
143
'Cannot render headers after they are sent to the client'
149
144
) ;
150
145
151
146
assert . strictEqual (
152
- errors . message ( 'ERR_INVALID_DOMAIN_NAME' ) ,
147
+ errors . getMessage ( 'ERR_INVALID_DOMAIN_NAME' , [ ] ) ,
153
148
'Unable to determine the domain name'
154
149
) ;
155
150
156
151
assert . strictEqual (
157
- errors . message ( 'ERR_INVALID_HTTP_TOKEN' , [ 'Method' , 'foo' ] ) ,
152
+ errors . getMessage ( 'ERR_INVALID_HTTP_TOKEN' , [ 'Method' , 'foo' ] ) ,
158
153
'Method must be a valid HTTP token ["foo"]'
159
154
) ;
160
155
161
156
assert . strictEqual (
162
- errors . message ( 'ERR_OUT_OF_RANGE' , [ 'A' , 'some values' , 'B' ] ) ,
157
+ errors . getMessage ( 'ERR_OUT_OF_RANGE' , [ 'A' , 'some values' , 'B' ] ) ,
163
158
'The value of "A" is out of range. It must be some values. Received B'
164
159
) ;
165
160
166
161
assert . strictEqual (
167
- errors . message ( 'ERR_UNESCAPED_CHARACTERS' , [ 'Request path' ] ) ,
162
+ errors . getMessage ( 'ERR_UNESCAPED_CHARACTERS' , [ 'Request path' ] ) ,
168
163
'Request path contains unescaped characters'
169
164
) ;
170
165
171
166
// Test ERR_DNS_SET_SERVERS_FAILED
172
167
assert . strictEqual (
173
- errors . message ( 'ERR_DNS_SET_SERVERS_FAILED' , [ 'err' , 'servers' ] ) ,
168
+ errors . getMessage ( 'ERR_DNS_SET_SERVERS_FAILED' , [ 'err' , 'servers' ] ) ,
174
169
'c-ares failed to set servers: "err" [servers]' ) ;
175
170
176
171
// Test ERR_ENCODING_NOT_SUPPORTED
177
172
assert . strictEqual (
178
- errors . message ( 'ERR_ENCODING_NOT_SUPPORTED' , [ 'enc' ] ) ,
173
+ errors . getMessage ( 'ERR_ENCODING_NOT_SUPPORTED' , [ 'enc' ] ) ,
179
174
'The "enc" encoding is not supported' ) ;
180
175
181
176
// Test error messages for async_hooks
182
177
assert . strictEqual (
183
- errors . message ( 'ERR_ASYNC_CALLBACK' , [ 'init' ] ) ,
178
+ errors . getMessage ( 'ERR_ASYNC_CALLBACK' , [ 'init' ] ) ,
184
179
'init must be a function' ) ;
185
180
assert . strictEqual (
186
- errors . message ( 'ERR_ASYNC_TYPE' , [ { } ] ) ,
181
+ errors . getMessage ( 'ERR_ASYNC_TYPE' , [ { } ] ) ,
187
182
'Invalid name for async "type": [object Object]' ) ;
188
183
assert . strictEqual (
189
- errors . message ( 'ERR_INVALID_ASYNC_ID' , [ 'asyncId' , undefined ] ) ,
184
+ errors . getMessage ( 'ERR_INVALID_ASYNC_ID' , [ 'asyncId' , undefined ] ) ,
190
185
'Invalid asyncId value: undefined' ) ;
191
186
192
187
{
0 commit comments