better error handling for api.weather.gov
This commit is contained in:
parent
9a09ccd1ea
commit
eb321005d9
12 changed files with 39 additions and 69 deletions
|
|
@ -59,6 +59,14 @@ class TravelForecast extends WeatherDisplay {
|
|||
// wait for all forecasts
|
||||
const forecasts = await Promise.all(forecastPromises);
|
||||
this.data = forecasts;
|
||||
|
||||
// test for some data available in at least one forecast
|
||||
const hasData = this.data.reduce((acc,forecast) => acc || forecast.high, false);
|
||||
if (!hasData) {
|
||||
this.setStatus(STATUS.noData);
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawCanvas(true);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue