@@ -143,56 +143,41 @@ WeatherProvider.register("openmeteo", {
143143 } ,
144144
145145 fetchCurrentWeather ( ) {
146- this . fetchData ( this . getUrl ( ) )
146+ return this . fetchData ( this . getUrl ( ) )
147147 . then ( ( data ) => this . parseWeatherApiResponse ( data ) )
148148 . then ( ( parsedData ) => {
149149 if ( ! parsedData ) {
150- // No usable data?
151- return ;
150+ throw new Error ( "No usable data ..." ) ;
152151 }
153-
154152 const currentWeather = this . generateWeatherDayFromCurrentWeather ( parsedData ) ;
155153 this . setCurrentWeather ( currentWeather ) ;
156154 } )
157- . catch ( function ( request ) {
158- Log . error ( "Could not load data ... " , request ) ;
159- } )
160155 . finally ( ( ) => this . updateAvailable ( ) ) ;
161156 } ,
162157
163158 fetchWeatherForecast ( ) {
164- this . fetchData ( this . getUrl ( ) )
159+ return this . fetchData ( this . getUrl ( ) )
165160 . then ( ( data ) => this . parseWeatherApiResponse ( data ) )
166161 . then ( ( parsedData ) => {
167162 if ( ! parsedData ) {
168- // No usable data?
169- return ;
163+ throw new Error ( "No usable data ..." ) ;
170164 }
171-
172165 const dailyForecast = this . generateWeatherObjectsFromForecast ( parsedData ) ;
173166 this . setWeatherForecast ( dailyForecast ) ;
174167 } )
175- . catch ( function ( request ) {
176- Log . error ( "Could not load data ... " , request ) ;
177- } )
178168 . finally ( ( ) => this . updateAvailable ( ) ) ;
179169 } ,
180170
181171 fetchWeatherHourly ( ) {
182- this . fetchData ( this . getUrl ( ) )
172+ return this . fetchData ( this . getUrl ( ) )
183173 . then ( ( data ) => this . parseWeatherApiResponse ( data ) )
184174 . then ( ( parsedData ) => {
185175 if ( ! parsedData ) {
186- // No usable data?
187- return ;
176+ throw new Error ( "No usable data ..." ) ;
188177 }
189-
190178 const hourlyForecast = this . generateWeatherObjectsFromHourly ( parsedData ) ;
191179 this . setWeatherHourly ( hourlyForecast ) ;
192180 } )
193- . catch ( function ( request ) {
194- Log . error ( "Could not load data ... " , request ) ;
195- } )
196181 . finally ( ( ) => this . updateAvailable ( ) ) ;
197182 } ,
198183
0 commit comments