@@ -31,6 +31,7 @@ const util = require('util');
31
31
const debug = util . debuglog ( 'stream' ) ;
32
32
const BufferList = require ( 'internal/streams/BufferList' ) ;
33
33
const destroyImpl = require ( 'internal/streams/destroy' ) ;
34
+ const errors = require ( 'internal/errors' ) ;
34
35
var StringDecoder ;
35
36
36
37
util . inherits ( Readable , Stream ) ;
@@ -233,11 +234,12 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
233
234
234
235
if ( addToFront ) {
235
236
if ( state . endEmitted )
236
- stream . emit ( 'error' , new Error ( 'stream.unshift() after end event' ) ) ;
237
+ stream . emit ( 'error' ,
238
+ new errors . Error ( 'ERR_STREAM_UNSHIFT_AFTER_END_EVENT' ) ) ;
237
239
else
238
240
addChunk ( stream , state , chunk , true ) ;
239
241
} else if ( state . ended ) {
240
- stream . emit ( 'error' , new Error ( 'stream.push() after EOF ' ) ) ;
242
+ stream . emit ( 'error' , new errors . Error ( 'ERR_STREAM_PUSH_AFTER_EOF ' ) ) ;
241
243
} else {
242
244
state . reading = false ;
243
245
if ( state . decoder && ! encoding ) {
@@ -548,7 +550,7 @@ function maybeReadMore_(stream, state) {
548
550
// for virtual (non-string, non-buffer) streams, "length" is somewhat
549
551
// arbitrary, and perhaps not very meaningful.
550
552
Readable . prototype . _read = function ( n ) {
551
- this . emit ( 'error' , new Error ( '_read() is not implemented ' ) ) ;
553
+ this . emit ( 'error' , new errors . Error ( 'ERR_STREAM_READ_NOT_IMPLEMENTED ' ) ) ;
552
554
} ;
553
555
554
556
Readable . prototype . pipe = function ( dest , pipeOpts ) {
0 commit comments