-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Throw an error when Chromium download is failed #619
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
Throw an error when Chromium download is failed #619
Conversation
|
This would play nice with #606 Codewise, we should probably process.exit(1) to terminate the script with non-zero exit code |
|
We can do the process.exit(1) from the onError function |
|
@homaily any updates on this? I'm very interested in this PR. |
|
@aslushnikov Sorry didn't get your point. Do you want the process.exit in the onError on int the place of throw Error? |
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.
Ah sorry, I got confused. I thought something else is going on here.
| .catch(err => err) | ||
| .catch(err => { throw err; }) | ||
| .then(() => { | ||
| if (fs.existsSync(zipPath)) |
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.
Unfortunately, there's no "finally" in promise chains, so I'd fake it like this:
.catch(err => err)
.then(err => {
if (fs.existsSync(zipPath))
fs.unlinkSync(zipPath);
if (err)
throw err;
});This way we'll throw an error and cleanup zip if any
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.
Much better love it. I've updated my code to do that.
Finishing the promise chain to remove the partially downloaded zip file (if exists)
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.
Thanks!
|
You're welcome Andrey. Appreciated. |
Hi,
When Chromium download is failed (no internet connection for example) downloadRevision will not emit an error and therefore onError function in the install file will not be triggered and the user will not see the message:
I'm using Node v6.11.2