File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const {
44
44
codes : {
45
45
ERR_INVALID_ARG_TYPE ,
46
46
ERR_INVALID_RETURN_VALUE ,
47
+ ERR_INVALID_STATE ,
47
48
} ,
48
49
} = require ( 'internal/errors' ) ;
49
50
@@ -213,8 +214,7 @@ class Body {
213
214
const { readable } = this [ kState ] ;
214
215
215
216
if ( readable === null ) {
216
- // TODO: What error?
217
- throw new Error ( 'readable consumed' ) ;
217
+ throw new ERR_INVALID_STATE ( 'Body is not readable' ) ;
218
218
}
219
219
220
220
this [ kState ] . readable = null ;
@@ -226,8 +226,7 @@ class Body {
226
226
const { writable } = this [ kState ] ;
227
227
228
228
if ( writable === null ) {
229
- // TODO: What error?
230
- throw new Error ( 'writable consumed' ) ;
229
+ throw new ERR_INVALID_STATE ( 'Body is not writable' ) ;
231
230
}
232
231
233
232
this [ kState ] . writable = null ;
@@ -237,13 +236,11 @@ class Body {
237
236
238
237
nodeStream ( ) {
239
238
if ( this . readable === null ) {
240
- // TODO: What error?
241
- throw new Error ( 'readable consumed' ) ;
239
+ throw new ERR_INVALID_STATE ( 'Body is not readable' ) ;
242
240
}
243
241
244
242
if ( this . writable === null ) {
245
- // TODO: What error?
246
- throw new Error ( 'writable consumed' ) ;
243
+ throw new ERR_INVALID_STATE ( 'Body is not writable' ) ;
247
244
}
248
245
249
246
if ( this [ kState ] . readable === this [ kState ] . writable ) {
You can’t perform that action at this time.
0 commit comments