Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb73574

Browse filesBrowse files
kevinoidrvagg
authored andcommitted
doc: clarify when writable.write callback is called
The current documentation for writable.write only specifies that the callback is called "once the data has been fully handled". It is ambiguous whether this means "successfully handled" and, if so, whether the callback is called if the data can not be successfully handled (i.e. an error occurs). The ambiguity is not only in the documentation. The stream class implementations differ on this point. stream.Writable invokes the callback with any errors that occur during parameter checking or during calls to _write. However, not all classes return all errors to _write. zlib.Zlib does pass argument and state errors to the _write (_transform) callback, but does not pass data errors. http.OutgoingMessage passes argument type errors and some other types of errors, but not all. This inconsistency is behind issue #1746 and, I suspect, other issues in client code which passes a callback to write. This commit takes no position on whether the callback error behavior should changed, but simply attempts to document the current behavior in a way that is open to changes so that users are not caught by surprise. PR-URL: #4810 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremy Whitlock <jwhitlock@apache.org> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent c579507 commit eb73574
Copy full SHA for eb73574

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Open diff view settings
Collapse file

‎doc/api/stream.markdown‎

Copy file name to clipboardExpand all lines: doc/api/stream.markdown
+3-1Lines changed: 3 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,9 @@ Flush all data, buffered since [`stream.cork()`][] call.
710710
* Returns: {Boolean} `true` if the data was handled completely.
711711

712712
This method writes some data to the underlying system, and calls the
713-
supplied callback once the data has been fully handled.
713+
supplied callback once the data has been fully handled. If an error
714+
occurs, the callback may or may not be called with the error as its
715+
first argument. To detect write errors, listen for the `'error'` event.
714716

715717
The return value indicates if you should continue writing right now.
716718
If the data had to be buffered internally, then it will return

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.