-
Notifications
You must be signed in to change notification settings - Fork 502
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
throwOnError does not work on HTTPParserError #3136
Comments
Throw on error is not related to this.
Here is a correct version of your code that does not throw uncaught:
|
Based on this, I would expect an error to be thrown as the request ends with 404. |
The const fs = require('node:fs');
const { stream } = require('undici');
stream(
'http://www.rolbox.it/rk-kastelruth/webcam/web03.jpg',
{
throwOnError: true,
method: 'GET',
},
() => fs.createWriteStream('/tmp/test.jpg'),
)
.then(() => console.log('then called'))
.catch(e => console.error('catch called:', e))
.finally(() => console.log('finally called')); output:
|
I believe this was fixed |
Bug Description
throwOnError
does not work onHTTPParserError
.Reproducible By
output:
Expected Behavior
I would expect the
HTTPParserError
to be caught incatch
and not to get unhandled rejection.Environment
Node v20.12.2
Additional context
The behavior with
throwOnError: false
is also weird.output:
The text was updated successfully, but these errors were encountered: