@@ -93,95 +93,90 @@ common.expectsError(() => {
9393} ) ;
9494
9595// 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' ] ) ,
9797 'Unsupported fd type: a' ) ;
9898
9999// 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' ] ) ,
101101 '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' ] ] ) ,
103103 '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' ] ] ) ,
105106 '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' ] ] ) ,
107109 'The URL must be one of scheme a, b, or c' ) ;
108110common . expectsError (
109- ( ) => errors . message ( 'ERR_INVALID_URL_SCHEME' , [ [ ] ] ) ,
111+ ( ) => errors . getMessage ( 'ERR_INVALID_URL_SCHEME' , [ [ ] ] ) ,
110112 {
111113 code : 'ERR_ASSERTION' ,
112114 type : assert . AssertionError ,
113115 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 $ /
114116 } ) ;
115117
116118// Test ERR_MISSING_ARGS
117- assert . strictEqual ( errors . message ( 'ERR_MISSING_ARGS' , [ 'name' ] ) ,
119+ assert . strictEqual ( errors . getMessage ( 'ERR_MISSING_ARGS' , [ 'name' ] ) ,
118120 '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' ] ) ,
120122 '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' ] ) ,
122124 '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- } ) ;
130125
131126// Test ERR_SOCKET_BAD_PORT
132127assert . strictEqual (
133- errors . message ( 'ERR_SOCKET_BAD_PORT' , [ 0 ] ) ,
128+ errors . getMessage ( 'ERR_SOCKET_BAD_PORT' , [ 0 ] ) ,
134129 'Port should be > 0 and < 65536. Received 0.' ) ;
135130
136131// Test ERR_TLS_CERT_ALTNAME_INVALID
137132assert . strictEqual (
138- errors . message ( 'ERR_TLS_CERT_ALTNAME_INVALID' , [ 'altname' ] ) ,
133+ errors . getMessage ( 'ERR_TLS_CERT_ALTNAME_INVALID' , [ 'altname' ] ) ,
139134 'Hostname/IP does not match certificate\'s altnames: altname' ) ;
140135
141136assert . strictEqual (
142- errors . message ( 'ERR_INVALID_PROTOCOL' , [ 'bad protocol' , 'http' ] ) ,
137+ errors . getMessage ( 'ERR_INVALID_PROTOCOL' , [ 'bad protocol' , 'http' ] ) ,
143138 'Protocol "bad protocol" not supported. Expected "http"'
144139) ;
145140
146141assert . strictEqual (
147- errors . message ( 'ERR_HTTP_HEADERS_SENT' , [ 'render' ] ) ,
142+ errors . getMessage ( 'ERR_HTTP_HEADERS_SENT' , [ 'render' ] ) ,
148143 'Cannot render headers after they are sent to the client'
149144) ;
150145
151146assert . strictEqual (
152- errors . message ( 'ERR_INVALID_HTTP_TOKEN' , [ 'Method' , 'foo' ] ) ,
147+ errors . getMessage ( 'ERR_INVALID_HTTP_TOKEN' , [ 'Method' , 'foo' ] ) ,
153148 'Method must be a valid HTTP token ["foo"]'
154149) ;
155150
156151assert . strictEqual (
157- errors . message ( 'ERR_OUT_OF_RANGE' , [ 'A' , 'some values' , 'B' ] ) ,
152+ errors . getMessage ( 'ERR_OUT_OF_RANGE' , [ 'A' , 'some values' , 'B' ] ) ,
158153 'The value of "A" is out of range. It must be some values. Received B'
159154) ;
160155
161156assert . strictEqual (
162- errors . message ( 'ERR_UNESCAPED_CHARACTERS' , [ 'Request path' ] ) ,
157+ errors . getMessage ( 'ERR_UNESCAPED_CHARACTERS' , [ 'Request path' ] ) ,
163158 'Request path contains unescaped characters'
164159) ;
165160
166161// Test ERR_DNS_SET_SERVERS_FAILED
167162assert . strictEqual (
168- errors . message ( 'ERR_DNS_SET_SERVERS_FAILED' , [ 'err' , 'servers' ] ) ,
163+ errors . getMessage ( 'ERR_DNS_SET_SERVERS_FAILED' , [ 'err' , 'servers' ] ) ,
169164 'c-ares failed to set servers: "err" [servers]' ) ;
170165
171166// Test ERR_ENCODING_NOT_SUPPORTED
172167assert . strictEqual (
173- errors . message ( 'ERR_ENCODING_NOT_SUPPORTED' , [ 'enc' ] ) ,
168+ errors . getMessage ( 'ERR_ENCODING_NOT_SUPPORTED' , [ 'enc' ] ) ,
174169 'The "enc" encoding is not supported' ) ;
175170
176171// Test error messages for async_hooks
177172assert . strictEqual (
178- errors . message ( 'ERR_ASYNC_CALLBACK' , [ 'init' ] ) ,
173+ errors . getMessage ( 'ERR_ASYNC_CALLBACK' , [ 'init' ] ) ,
179174 'init must be a function' ) ;
180175assert . strictEqual (
181- errors . message ( 'ERR_ASYNC_TYPE' , [ { } ] ) ,
176+ errors . getMessage ( 'ERR_ASYNC_TYPE' , [ { } ] ) ,
182177 'Invalid name for async "type": [object Object]' ) ;
183178assert . strictEqual (
184- errors . message ( 'ERR_INVALID_ASYNC_ID' , [ 'asyncId' , undefined ] ) ,
179+ errors . getMessage ( 'ERR_INVALID_ASYNC_ID' , [ 'asyncId' , undefined ] ) ,
185180 'Invalid asyncId value: undefined' ) ;
186181
187182{
0 commit comments