mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-13 11:29:53 +03:00
Better error handling, but not perfect.
This commit is contained in:
parent
c3521336d2
commit
1e220cd4cd
1 changed files with 12 additions and 4 deletions
|
@ -157,14 +157,20 @@ var ublox = (function () {
|
||||||
if(req.status == 200) {
|
if(req.status == 200) {
|
||||||
successCallback(req.response);
|
successCallback(req.response);
|
||||||
} else {
|
} 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) {
|
if (failCallback != null) {
|
||||||
req.onerror = (event) => {
|
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);
|
req.send(null);
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
|
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) {
|
function loadError(e) {
|
||||||
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
|
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:
|
// For more info on assistnow, check:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue