diff --git a/doc/api/stream.md b/doc/api/stream.md index bf7ee7251af392..d1b77c30fe5524 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -432,6 +432,19 @@ file.end('world!'); // Writing more now is not allowed! ``` +[`stream.end()`][stream-end] will call its callback and emit `'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()`][writable-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`][] is `true`. +* Last error emitted by the instance through `'error'` before + [`writable.writableFinished`][] is set to `true`. + ##### writable.setDefaultEncoding(encoding)