From 3de5eae6dbe503485b95bdeb8bddbd67e4613d59 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 24 Aug 2019 16:33:46 +0200 Subject: stream: invoke callback before emitting error always Ensure the callback is always invoked before emitting the error in both sync and async case. PR-URL: https://github.com/nodejs/node/pull/29293 Reviewed-By: Matteo Collina Reviewed-By: James M Snell --- doc/api/stream.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/api/stream.md b/doc/api/stream.md index d4dbe54dbc..48b478a58e 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -571,7 +571,8 @@ The `writable.write()` method writes some data to the stream, and calls the supplied `callback` once the data has been fully handled. If an error occurs, the `callback` *may or may not* be called with the error as its first argument. To reliably detect write errors, add a listener for the -`'error'` event. +`'error'` event. If `callback` is called with an error, it will be called +before the `'error'` event is emitted. The return value is `true` if the internal buffer is less than the `highWaterMark` configured when the stream was created after admitting `chunk`. -- cgit v1.2.3