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 {
4444 codes : {
4545 ERR_INVALID_ARG_TYPE ,
4646 ERR_INVALID_RETURN_VALUE ,
47+ ERR_INVALID_STATE ,
4748 } ,
4849} = require ( 'internal/errors' ) ;
4950
@@ -213,8 +214,7 @@ class Body {
213214 const { readable } = this [ kState ] ;
214215
215216 if ( readable === null ) {
216- // TODO: What error?
217- throw new Error ( 'readable consumed' ) ;
217+ throw new ERR_INVALID_STATE ( 'Body is not readable' ) ;
218218 }
219219
220220 this [ kState ] . readable = null ;
@@ -226,8 +226,7 @@ class Body {
226226 const { writable } = this [ kState ] ;
227227
228228 if ( writable === null ) {
229- // TODO: What error?
230- throw new Error ( 'writable consumed' ) ;
229+ throw new ERR_INVALID_STATE ( 'Body is not writable' ) ;
231230 }
232231
233232 this [ kState ] . writable = null ;
@@ -237,13 +236,11 @@ class Body {
237236
238237 nodeStream ( ) {
239238 if ( this . readable === null ) {
240- // TODO: What error?
241- throw new Error ( 'readable consumed' ) ;
239+ throw new ERR_INVALID_STATE ( 'Body is not readable' ) ;
242240 }
243241
244242 if ( this . writable === null ) {
245- // TODO: What error?
246- throw new Error ( 'writable consumed' ) ;
243+ throw new ERR_INVALID_STATE ( 'Body is not writable' ) ;
247244 }
248245
249246 if ( this [ kState ] . readable === this [ kState ] . writable ) {
You can’t perform that action at this time.
0 commit comments