-
-
Notifications
You must be signed in to change notification settings - Fork 939
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
Body stream error is not caught by Got #1046
Comments
That's because we use
I wouldn't consider this a bug, although it's quite annoying behavior. @sindresorhus Should this be configurable through an option? For example |
@szmarczak I agree it can be considered as not a bug (I had second thoughts when I opened the issue), although it's [possibly naively] expected that the library will catch any related exceptions, like it already does very nicely. Thank you for considering a solution for this, I really appreciate it. |
Got is the one consuming the |
We should open an issue on Node.js about this. That's definitely not the wanted (or useful) behavior. I assumed it would forward the error to the last stream or the callback to |
You assumed correctly. It's just that there's no error handler for |
It's just that it throws the error before Got has the time to attach a handler... |
Fixed :) |
Awesome, thanks!! |
Describe the bug
When using streams to upload a file, an error thrown from the stream read (for example, passing an inexistent file path) is not being caught by
got
.This looks similar to #614
Actual behavior
The code in the example throws an error that is not caught by
got
itself.Console output:
Expected behavior
The error should be caught and "caught error" should be logged to the console.
Code to reproduce
PR with failing test: #1047
Checklist
The text was updated successfully, but these errors were encountered: