Skip to content

Commit

Permalink
Merge pull request #2344 from iNavFlight/mmosca-patch-assistnow-error…
Browse files Browse the repository at this point in the history
…-handling

Improve error reporting for assitnow
  • Loading branch information
mmosca authored Feb 13, 2025
2 parents a19f985 + 1e220cd commit 4cffca2
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions js/ublox/UBLOX.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,37 @@ 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.");
}
}

try {
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(event) {
function loadError(e) {
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
var dec = new TextDecoder('utf-8');
GUI.log(JSON.stringify(e));
}

// For more info on assistnow, check:
Expand Down

0 comments on commit 4cffca2

Please sign in to comment.