-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom _destroy
can swallow error?
#30979
Labels
stream
Issues and PRs related to the stream subsystem.
Comments
ping @lpinca |
It is done on purpose so I think it's ok. |
@lpinca: then how about the case when const write = new Writable({
write(chunk, enc, cb) { cb(); },
destroy: common.mustCall(function(err, cb) {
assert.strictEqual(err, expected);
cb();
})
});
const expected = new Error('kaboom');
write.on('finish', common.mustNotCall('no finish event'));
write.on('close', common.mustCall());
// Error is swallowed by the custom _destroy
write.on('error', common.mustNotCall('no error event'));
write.destroy(expected);
write.destroy(expected); // No longer swallowed... **HERE**
assert.strictEqual(write.destroyed, true); |
Agreed, not sure how to fix that. |
Keep it simple and don’t allow suppressing errors? Or is that too significant? |
I would be ok with that. |
4 tasks
ronag
added a commit
to nxtedition/node
that referenced
this issue
Dec 15, 2019
The first stream error is the only one that gets emitted as 'error' or forwarded in callbacks. Also it cannot be override by _destroy. Refs: nodejs#30979
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Was looking through the stream
destroy
tests and noticed this. Is this something we want? I would expect that the error would not get swallowed? i.e. I would expect the original/first error to always propagate.The text was updated successfully, but these errors were encountered: