-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
cannot catch errors like net::ERR_NETWORK_CHANGED, net::ERR_CONNECTION_RESET #2398
Comments
Same problem here, have you figured out how to solve it? |
I am experiencing issues with this as well. Do we have any workaround for it? |
@btibarra @FantasticFiasco thanks for replying guys. No reply from package developers for now. As a temporary workaround you can try catching errors with |
Thanks for the reply @hvuntokrul , I will try with one of your suggestions 👍 |
Sounds like #2451. I’d really love to catch them as well, so they don’t end up in Rollbar (which uses I don’t know for sure, but it looks like that might be this: electron-builder/packages/electron-updater/src/AppUpdater.ts Lines 339 to 346 in 9d6eb96
Everywhere in |
@develar Where do I need to send money so this can be finally resolved? |
@DominikLevitsky Donation doesn't mean that issue will be resolved ASAP. No obligations. If you can provide reproducible steps — it will help. |
@develar The most reliable way to reproduce the issue is to start updating the Electron application while the computer is connected to the internet via a Wi-Fi network and connect to another network while the update is still in progress |
same here |
+1 |
is there a solution cooking for this issue?? |
how about this issue ? |
got the same issue :( |
Here's an example of what I got to work for me. I was only able to catch all of them if autoDownload == false. autoUpdater.autoDownload = false;
function checkForUpdates() {
autoUpdater.checkForUpdates().then((info) => {
if (autoUpdater.updateAvailable) {
downloadUpdate(info.cancellationToken);
} else {
log.info('Update not available')
}
}).catch((error) => {
if (isNetworkError(error)) {
log.info('Network Error');
} else {
log.info('Unknown Error');
log.info(error == null ? "unknown" : (error.stack || error).toString());
}
});
}
function downloadUpdate(cancellationToken) {
autoUpdater.downloadUpdate(cancellationToken).then((file) => {
setImmediate(() => autoUpdater.quitAndInstall());
}).catch((error) => {
if (isNetworkError(error)) {
log.info('Network Error');
} else {
log.info('Unknown Error');
log.info(error == null ? "unknown" : (error.stack || error).toString());
}
});
}
function isNetworkError(errorObject) {
return errorObject.message === "net::ERR_INTERNET_DISCONNECTED" ||
errorObject.message === "net::ERR_PROXY_CONNECTION_FAILED" ||
errorObject.message === "net::ERR_CONNECTION_RESET" ||
errorObject.message === "net::ERR_CONNECTION_CLOSE" ||
errorObject.message === "net::ERR_NAME_NOT_RESOLVED" ||
errorObject.message === "net::ERR_CONNECTION_TIMED_OUT";
} |
I played around the issue on Windows for about few hours trying different ideas and came up with a simple PR which makes |
Hi all, Regarding the above suggestions, even though it's not a best practice according to nodejs docs, how can it be solved using process.on('uncauhghtException', err => ...)? |
@tjazak - In what version of auto updater are you using? |
I believe this issue can be closed now that this PR by @vladimiry has been merged and released in electron-updater@4.0.7. |
I still see this issue after forcing the install of 4.0.7 (i.e. 4.0.6 is still considered latest right now). Traced the issue into httpExecutor added a patch to configurePipes(). The code already listens for I only patched configurePipes(), other parts of httpExecutor may also need listeners.
I'm applying the patch using patch-package Hope this^ info helps others. Happy to whip up a PR if this looks like a legit fix. --- big thanks to electron-builder !!! |
By the way, that PR tweaked only |
I use I need to amend the patch/comments -- after waiting 10min i didn't see the error, so I enabled wifi again, and saw the error ( |
@thetroy I can only suggest you make sure you are using the most recent electron-updater version which is currently 4.0.11 and if still fails to try switching to 4.0.7. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This really shouldn't be closed because the bug is still happening. What @thetroy posted is spot on. Applying the patch and listening to the error event on the response fixes the issue of an uncaught error during update download, which else will lead to the application just crashing. |
Error: net::ERR_NETWORK_IO_SUSPENDED` on computer sleep, the cause could possibly be not explicitly setting a timeout on the http calls. |
Try v.22.3.1 available as electron-builder@next npm package. There should be a fix for this issue. If it doesn't work check if connection exists before check for update. |
Looks like the issue is still unfortunately present as of 22.3.5 - I see the |
If I'm understanding correctly, this issue should be re-opened since a global error handler is still required to catch certain connection exceptions:
It would be very helpful if someone could post a simple repository that reliably generates these errors. Regarding |
@alanning I don't believe 22.3.5 has that patch in it, I don't see a merged PR that contains it (but @thetroy, let me know if I'm wrong!). It would be great to get that in a PR. I can consistently reproduce the |
Hey folks 👋 Just wanted to update you - I tried applying @thetroy's fix via patch-package over the weekend, but we're unfortunately still seeing the Do you all think it would be alright for me to create a new issue in lieu of re-opening this one, since this does seem to still be affecting all of us? Might be helpful for others who are hitting this as well; since Electron 7 refactored the net module, I suspect other folks who upgraded will be seeing more of this error soon. |
Still happening here. @VerteDinde did you create a new issue? |
@alanning I have a repository that always exhibits the error when a Windows OS sleeps and is unsuspended while the app is running, https://github.com/lacymorrow/crossover. @VerteDinde A new issue is fine, just link us when you create it 👍 |
Hello, Still an issue for me too. Thanks |
issue is still present for me with any updates? |
I managed to deal with it this way. try {
const updateCheckResult = await autoUpdater.checkForUpdates();
if (updateCheckResult.downloadPromise) {
updateCheckResult.downloadPromise.catch(error => {
console.error('Error while downloading the update: ', error);
});
}
} catch (error) {
console.error('Error while on checkForUpdates: ', error);
} |
I also experience this issue still, why is it closed? |
…date download the error will just be thrown by the net module if there's no error handler, leading to issues like electron-userland#2398
the error will just be thrown by the net module if there's no error handler, leading to issues like electron-userland#2398
the error will just be thrown by the net module if there's no error handler, leading to issues like electron-userland#2398
) The error will just be thrown by the net module if there's no error handler. Fixes #2398
description of what you're trying to do:
I am trying to catch errors like: net::ERR_NETWORK_CHANGED, net::ERR_CONNECTION_RESET, net::ERR_SPDY_PROTOCOL_ERROR, net::ERR_CONNECTION_CLOSED etc,
but autoUpdater.on('error', errorHandler); (import { autoUpdater } from 'electron-updater';) does not catch them and errors go straight to process.on(‘uncaughtException’, handleUncaught). Most errors occur when the internet connection is lost while downloading an update.
package.json:
log of the terminal output:
node version:
8.4.0
npm version:
5.0.3
on which system do you want to create installers (macOS, Linux or Windows):
macOS and Windows
The text was updated successfully, but these errors were encountered: