stream: don't emit finish on error
I noticed some strange behaviour while working on https://github.com/nodejs/node/pull/28978.
finish
should not be emitted if a write has failed.
EDIT: This is blocking work on a few other PR's.
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
NOTE TO SELF: look into errorOrDestroy
emitting async (emit-nextTick), needFinish should take into account .errorEmitted