-
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
stream: readable throw unhandled error #29806
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const { Readable, Writable } = require('stream'); | ||
|
||
process.on('uncaughtException', common.mustCall((err) => { | ||
assert.strictEqual(err.message, 'asd'); | ||
})); | ||
|
||
const r = new Readable({ | ||
read () { | ||
ronag marked this conversation as resolved.
Show resolved
Hide resolved
|
||
this.push('asd'); | ||
} | ||
}); | ||
const w = new Writable({ | ||
autoDestroy: true, | ||
write() {} | ||
}); | ||
|
||
r.pipe(w); | ||
w.destroy(new Error('asd')); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm... this ends up changing the semantics of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure I follow. All this PR does is to re-emit the already emitted error. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in other places we just re-emit (like this) instead of throwing, e.g. https://github.com/nodejs/node/blob/master/lib/internal/streams/legacy.js#L56 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will only emit error if not autoDestroy