Skip to content

Commit

Permalink
fixup: writable
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Sep 22, 2019
1 parent 82f209e commit 25c4396
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -1852,13 +1852,11 @@ or write buffered data before a stream ends.

#### Errors While Writing

It is recommended that errors occurring during the processing of the
`writable._write()` and `writable._writev()` methods are reported by invoking
the callback and passing the error as the first argument. This will cause an
`'error'` event to be emitted by the `Writable`. Throwing an `Error` from within
`writable._write()` can result in unexpected and inconsistent behavior depending
on how the stream is being used. Using the callback ensures consistent and
predictable handling of errors.
Errors occurring during the processing of the [`writable._write()`][],
[`writable._writev()`][] and [`writable._final()`] methods should be propagated
by invoking the callback and passing the error as the first argument.
Throwing an `Error` from within these methods or manually emitting an `'error'`
event results in undefined behavior.

If a `Readable` stream pipes into a `Writable` stream when `Writable` emits an
error, the `Readable` stream will be unpiped.
Expand Down Expand Up @@ -2761,6 +2759,9 @@ contain multi-byte characters.
[`writable.cork()`]: #stream_writable_cork
[`writable.end()`]: #stream_writable_end_chunk_encoding_callback
[`writable.uncork()`]: #stream_writable_uncork
[`writable._final()`]: #stream.html#stream_writable_final_callback
[`writable._write()`]: #stream.html#stream_writable_write_chunk_encoding_callback_1
[`writable._writev()`]: #stream.html#stream_writable_writev_chunks_callback
[`writable.writableFinished`]: #stream_writable_writablefinished
[`zlib.createDeflate()`]: zlib.html#zlib_zlib_createdeflate_options
[API for Stream Consumers]: #stream_api_for_stream_consumers
Expand Down

0 comments on commit 25c4396

Please sign in to comment.