[gnome-weather/wip/christopherdavis/make-resistant-to-missing-sky] city.js: Make resistant to the sky going missing




commit 4d61d8a723156cdde3718517e317725221b01f15
Author: Christopher Davis <brainblasted disroot org>
Date:   Thu Oct 8 18:40:38 2020 -0700

    city.js: Make resistant to the sky going missing
    
    The sky apparently went missing in London, according
    to yr.no. This commit addresses an issue where Weather would never get past the loading screen when the 
sky is missing.

 src/app/city.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/app/city.js b/src/app/city.js
index 3f066b9..a821604 100644
--- a/src/app/city.js
+++ b/src/app/city.js
@@ -116,10 +116,12 @@ function get_icon_name(info) {
                 return "weather-overcast";
 
             default: /* unrecognized */
+                log(`Unrecognized sky type: ${sky}`);
                 return null;
         }
     }
 
+    log(`Could not get a sky from info`);
     return null;
 }
 
@@ -306,13 +308,12 @@ var WeatherWidget = GObject.registerClass({
         this._conditionsImage.clear();
         this._conditionsImageSmall.clear();
 
-        const [resource, resourceSmall] = get_icon_resources(info);
-
         try {
+            const [resource, resourceSmall] = get_icon_resources(info);
             this._conditionsImage.set_from_resource(resource);
             this._conditionsImageSmall.set_from_resource(resourceSmall);
         } catch (err) {
-            log(`Failed to set weather icon from resource: ${resource}`);
+            log(`Failed to set weather icon from resource: ${err}`);
         }
 
         const [, tempValue] = info.get_value_temp(GWeather.TemperatureUnit.DEFAULT);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]