better error handling for api.weather.gov

This commit is contained in:
Matt Walsh
2020-09-09 15:23:19 -05:00
parent 9a09ccd1ea
commit eb321005d9
12 changed files with 39 additions and 69 deletions

View File

@@ -115,6 +115,12 @@ class RegionalForecast extends WeatherDisplay {
// filter out any false (unavailable data)
const regionalData = regionalDataAll.filter(data => data);
// test for data present
if (regionalData.length === 0) {
this.setStatus(STATUS.noData);
return;
}
// return the weather data and offsets
this.data = {
regionalData,
@@ -123,7 +129,6 @@ class RegionalForecast extends WeatherDisplay {
};
this.setStatus(STATUS.loaded);
this.drawCanvas();
}
buildForecast (forecast, city, cityXY) {