@@ -229,12 +229,12 @@ function Writable(options) {
229
229
230
230
// Otherwise people can pipe Writable streams, which is just wrong.
231
231
Writable . prototype . pipe = function ( ) {
232
- this . emit ( 'error' , new Error ( 'Cannot pipe, not readable ' ) ) ;
232
+ this . emit ( 'error' , new errors . Error ( 'ERR_STREAM_CANNOT_PIPE ' ) ) ;
233
233
} ;
234
234
235
235
236
236
function writeAfterEnd ( stream , cb ) {
237
- var er = new Error ( 'write after end ' ) ;
237
+ var er = new errors . Error ( 'ERR_STREAM_WRITE_AFTER_END ' ) ;
238
238
// TODO: defer error events consistently everywhere, not just the cb
239
239
stream . emit ( 'error' , er ) ;
240
240
process . nextTick ( cb , er ) ;
@@ -248,11 +248,11 @@ function validChunk(stream, state, chunk, cb) {
248
248
var er = false ;
249
249
250
250
if ( chunk === null ) {
251
- er = new TypeError ( 'May not write null values to stream ' ) ;
251
+ er = new errors . TypeError ( 'ERR_STREAM_NULL_VALUES ' ) ;
252
252
} else if ( typeof chunk !== 'string' &&
253
253
chunk !== undefined &&
254
254
! state . objectMode ) {
255
- er = new TypeError ( 'Invalid non- string/buffer chunk ' ) ;
255
+ er = new errors . TypeError ( 'ERR_INVALID_ARG_TYPE' , 'chunk' , ' string/buffer') ;
256
256
}
257
257
if ( er ) {
258
258
stream . emit ( 'error' , er ) ;
@@ -533,7 +533,7 @@ function clearBuffer(stream, state) {
533
533
}
534
534
535
535
Writable . prototype . _write = function ( chunk , encoding , cb ) {
536
- cb ( new Error ( '_write() is not implemented ' ) ) ;
536
+ cb ( new errors . Error ( 'ERR_METHOD_NOT_IMPLEMENTED' , '_transform ') ) ;
537
537
} ;
538
538
539
539
Writable . prototype . _writev = null ;
0 commit comments