diff --git a/lib/gui/components/update-notifier/services/update-notifier.js b/lib/gui/components/update-notifier/services/update-notifier.js index c0b1f447..ffafe4c5 100644 --- a/lib/gui/components/update-notifier/services/update-notifier.js +++ b/lib/gui/components/update-notifier/services/update-notifier.js @@ -22,6 +22,14 @@ const etcherLatestVersion = require('etcher-latest-version'); module.exports = function($http, $q, ModalService, UPDATE_NOTIFIER_SLEEP_TIME, ManifestBindService, SettingsModel) { + /** + * @summary The current application version + * @constant + * @private + * @type {String} + */ + const CURRENT_VERSION = ManifestBindService.get('version'); + /** * @summary Get the latest available Etcher version * @function @@ -48,6 +56,14 @@ module.exports = function($http, $q, ModalService, UPDATE_NOTIFIER_SLEEP_TIME, M }); }, (error, latestVersion) => { if (error) { + + // The error status equals -1 if the request couldn't + // be made successfully, for example, because of a + // timeout on an unstable network connection. + if (error.status === -1) { + return resolve(CURRENT_VERSION); + } + return reject(error); } @@ -75,7 +91,7 @@ module.exports = function($http, $q, ModalService, UPDATE_NOTIFIER_SLEEP_TIME, M */ this.isLatestVersion = () => { return this.getLatestVersion().then((version) => { - return semver.gte(ManifestBindService.get('version'), version); + return semver.gte(CURRENT_VERSION, version); }); };