1
0
Fork 0
mirror of https://github.com/iNavFlight/inav-configurator.git synced 2025-07-12 19:10:21 +03:00

Better error handling, but not perfect.

This commit is contained in:
Marcelo Bezerra 2025-02-13 20:11:40 +01:00
parent c3521336d2
commit 1e220cd4cd

View file

@ -157,14 +157,20 @@ var ublox = (function () {
if(req.status == 200) {
successCallback(req.response);
} else {
failCallback(event);
if(failCallback != null) {
var dec = new TextDecoder('utf-8');
GUI.log(`http status: ${req.status}: ${dec.decode(req.response)}`)
failCallback(req.response);
}
}
};
}
if (failCallback != null) {
req.onerror = (event) => {
failCallback(event);
var dec = new TextDecoder('utf-8');
GUI.log(i18n.getMessage("gpsAssistnowLoadDataError") + ": Received an unkonwn error when trying to download data.")
failCallback("Unknown error.");
}
}
@ -172,14 +178,16 @@ var ublox = (function () {
req.send(null);
} catch(error) {
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + error.toString());
GUI.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + error.toString());
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + JSON.stringify(error));
}
}
function loadError(e) {
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
GUI.log('response error: ' + e.currentTarget.response);
var dec = new TextDecoder('utf-8');
GUI.log(JSON.stringify(e));
}
// For more info on assistnow, check: