From b6933441ec995a31cc988520dfc1dbc9821ac1a2 Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Sat, 28 Sep 2019 09:39:14 +0200 Subject: [PATCH 1/8] doc: error modes of writable --- doc/api/stream.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/doc/api/stream.md b/doc/api/stream.md index bf7ee7251af392..ac76a001b3e18d 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -432,6 +432,18 @@ file.end('world!'); // Writing more now is not allowed! ``` +[`stream.end()`][stream-end] will error with (in order of precedence): +* `ERR_STREAM_WRITE_AFTER_END` if `chunk` is not nully and +[`stream.end()`][stream-end] has been called. +* `ERR_STREAM_DESTROYED` if `chunk` is not nully and +[`stream.destroy()`][stream-destroy] has been called. +* `ERR_INVALID_ARG_TYPE` if `chunk` is not nully and +`chunk` is not a `string` when not in `objectMode`. +* `ERR_STREAM_ALREADY_FINISHED` if +[`writable.writableFinished`][]. +* Any error emitted by the instance through `'error'` before +[`writable.writableFinished`][]. + ##### writable.setDefaultEncoding(encoding)