Fixes RYZEN-CONTROLLER-40 - Detect when checkForNewRelease is failing.

This commit is contained in:
Quentin DECAUNES 2019-07-30 17:12:28 +02:00
parent a7b0362f0f
commit 22be46426c

View File

@ -497,18 +497,22 @@ function checkForNewRelease() {
var request = new XMLHttpRequest(); var request = new XMLHttpRequest();
const version = require('./package.json').version; const version = require('./package.json').version;
request.open('GET', 'https://gitlab.com/api/v4/projects/11046417/releases', true); try {
request.open('GET', 'https://gitlab.com/api/v4/projects/11046417/releases', true);
request.onload = function() { request.onload = function() {
if (this.status >= 200 && this.status < 400) { if (this.status >= 200 && this.status < 400) {
var resp = JSON.parse(this.response); var resp = JSON.parse(this.response);
if (resp[0].tag_name !== version) { if (resp[0].tag_name !== version) {
notification('primary', "A new vesion is available, please check the release tab."); notification('primary', "A new vesion is available, please check the release tab.");
}
} }
} };
};
request.send();
request.send(); } catch (error) {
console.log('Unable to check if new release is available.', error);
}
} }
/** /**