You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
Throughout the codebase, there are some cases where we emit('error') right away on some user action, and other cases where we defer the error emit call until nextTick.
For example, Writable streams emit the error right away if you call write(chunk) after calling end(). However, there are many other cases where the error is deferred until nextTick (qv almost every error in lib/net.js).
On the one hand, you already have the object if you're calling write() on it, so you've had a chance to add an error listener. On the other hand, actual write() errors (EPIPE, etc.) usually don't happen synchronously, so it's odd to sometimes have to put the listener on before calling write() and other times not.
Since we can't make all errors synchronous, for obvious reasons, we may as well make all errors async, and defer emit('error', er) calls until nextTick. The throw site is already garbage, since it throws from inside events.js, so there's really no cost to deferring consistently.
At least, these probably need fixing:
lib/_stream_* (especially writable)
lib/fs.js (not sure if it's actually in there, but there is at least a test verifying that write-after-end throws)
dgram.js maybe
tls.js
Several tests
The text was updated successfully, but these errors were encountered:
Throughout the codebase, there are some cases where we
emit('error')
right away on some user action, and other cases where we defer the error emit call until nextTick.For example, Writable streams emit the error right away if you call
write(chunk)
after callingend()
. However, there are many other cases where the error is deferred until nextTick (qv almost every error in lib/net.js).On the one hand, you already have the object if you're calling write() on it, so you've had a chance to add an error listener. On the other hand, actual write() errors (EPIPE, etc.) usually don't happen synchronously, so it's odd to sometimes have to put the listener on before calling write() and other times not.
Since we can't make all errors synchronous, for obvious reasons, we may as well make all errors async, and defer
emit('error', er)
calls until nextTick. The throw site is already garbage, since it throws from inside events.js, so there's really no cost to deferring consistently.At least, these probably need fixing:
lib/_stream_*
(especially writable)lib/fs.js
(not sure if it's actually in there, but there is at least a test verifying that write-after-end throws)The text was updated successfully, but these errors were encountered: