Skip to content

Commit a19eb50

Browse files
authored
Merge pull request #2273 from iNavFlight/mmosca-fix-assistnow-error-handling
Correct assistnow data loading error handling
2 parents d6b57e3 + a7d644e commit a19eb50

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

js/ublox/UBLOX.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,11 @@ var ublox = (function () {
154154

155155
if (successCallback != null) {
156156
req.onload = (event) => {
157-
successCallback(req.response);
157+
if(req.status == 200) {
158+
successCallback(req.response);
159+
} else {
160+
failCallback(event);
161+
}
158162
};
159163
}
160164

@@ -164,13 +168,17 @@ var ublox = (function () {
164168
}
165169
}
166170

167-
req.send(null);
171+
try {
172+
req.send(null);
173+
} catch(error) {
174+
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
175+
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + error.toString());
176+
}
168177
}
169178

170179

171180
function loadError(event) {
172181
GUI.alert(i18n.getMessage("gpsAssistnowLoadDataError"));
173-
console.log(i18n.getMessage("gpsAssistnowLoadDataError") + ':' + event.toString());
174182
}
175183

176184
// For more info on assistnow, check:

0 commit comments

Comments
 (0)