[owmweather] handle error msg from parseWeather

master
Logan B 2025-06-11 16:36:37 -05:00
parent 7cc837d595
commit eca3bbb14b
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -10,7 +10,7 @@
return settings.refresh * 1000 * 60 + 1; // +1 <- leave some slack
};
let onCompleted = function (result) {
let onCompleted = function () {
loading = false;
settings.updated = Date.now();
require('Storage').writeJSON("owmweather.json", settings);

View File

@ -44,7 +44,11 @@ exports.pull = function(completionCallback, errorCallback) {
if (Bangle.http){
Bangle.http(uri, {timeout:10000}).then(event => {
let result = parseWeather(event.resp);
if (completionCallback) completionCallback(result);
if (result === undefined) {
if (completionCallback) completionCallback();
} else {
if (errorCallback) errorCallback(result);
}
}).catch((e)=>{
if (errorCallback) errorCallback(e);
});