-
-
Notifications
You must be signed in to change notification settings - Fork 957
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
Prevent uncaught exception in some cases #459
Conversation
Could you add a test for this? |
index.js
Outdated
const progressStream = new Transform({ | ||
transform(chunk, encoding, callback) { | ||
downloaded += chunk.length; | ||
try { |
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.
Can you move the contents of the try
into a function and call it from the try
, so we don't add more nesting.
I've put the code in a I've also added some files to work on VS Code on Windows. I can remove these if you want. |
Also: Travis is timing out, but this shows it's ok for at least node 4 and 8: https://travis-ci.org/sindresorhus/got/builds/346221646 |
Yes :). |
Ok, removed the .vscode folder! |
Thanks :) |
You're welcome! |
If something goes wrong in the code contained by setImmediate, an uncaughtException is thrown.
The code in this pull requests wraps the code in a try/catch block and emits an error if an error is thrown.