mirror of
https://github.com/netbymatt/ws4kp.git
synced 2026-04-19 01:59:31 -07:00
better error handling for api.weather.gov
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user