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
Actually, this fixes the error (stream.finished isn't actually important here). it seems it's standard for the error to not get passed through the pipe
readStream.on("error", (error) => {
const newError = new errlop('Caught the error', error);
writeStream.destroy(newError);
})
Version
16.13.0
Platform
Darwin Kernel Version 21.3.0: Wed Jan 5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_X86_64 x86_64
Subsystem
streams
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always reproduces
What is the expected behavior?
await stream.finished(writeStream) returns the cleanup function specified at https://nodejs.org/docs/latest-v16.x/api/stream.html#streamfinishedstream-options-callback so we can clean up the error call.
Or that error rejects the promise we're awaiting on and gets treated as part of the normal Promise error handling flow.
What do you see instead?
"Uncaught Error: Caught the error"
Additional information
https://github.com/nodejs/node/blob/master/lib/internal/streams/end-of-stream.js#L242 drops the cleanup function that
eos
returns.I think I can work around this by manually making my own promises that resolve/reject based on callbacks firing
The text was updated successfully, but these errors were encountered: