From 668235aed97bd0b16fa3fc27af913033e0ae595c Mon Sep 17 00:00:00 2001 From: Oj Date: Mon, 4 Apr 2022 08:23:02 +0100 Subject: [PATCH] [Updater > Host] Fail gracefully --- src/updater/hostUpdater.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/updater/hostUpdater.js b/src/updater/hostUpdater.js index 7994890..6365d3d 100644 --- a/src/updater/hostUpdater.js +++ b/src/updater/hostUpdater.js @@ -22,17 +22,18 @@ class HostLinux extends events.EventEmitter { try { const current = vParse(app.getVersion()); - get(this.updateUrl, (_e, res, body) => { + get(this.updateUrl, (err, res, body) => { + if (err) return this.emit('error'); if (res.statusCode === 204) return this.emit('update-not-available'); - const latest = vParse(JSON.parse(body).name); + const latest = vParse(JSON.parse(body).name); if (vNewer(latest, current)) return this.emit('update-manually', latest.join('.')); this.emit('update-not-available'); }); } catch (e) { log('HostLinux', 'Error', e); - this.emit('error', e); + this.emit('error'); } } }