File tree Expand file tree Collapse file tree 1 file changed +3
-8
lines changed
Expand file tree Collapse file tree 1 file changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -27,9 +27,8 @@ function parseWeather(response) {
2727 json . weather = weather ;
2828 require ( "Storage" ) . writeJSON ( 'weather.json' , json ) ;
2929 if ( require ( "Storage" ) . read ( "weather" ) !== undefined ) require ( "weather" ) . emit ( "update" , json . weather ) ;
30- return undefined ;
3130 } else {
32- return /*LANG*/ "Not OWM data" ;
31+ throw /*LANG*/ "Not OWM data" ;
3332 }
3433}
3534
@@ -43,12 +42,8 @@ exports.pull = function(completionCallback, errorCallback) {
4342 let uri = "https://api.openweathermap.org/data/2.5/weather?lat=" + location . lat . toFixed ( 2 ) + "&lon=" + location . lon . toFixed ( 2 ) + "&exclude=hourly,daily&appid=" + settings . apikey ;
4443 if ( Bangle . http ) {
4544 Bangle . http ( uri , { timeout :10000 } ) . then ( event => {
46- let result = parseWeather ( event . resp ) ;
47- if ( result === undefined ) {
48- if ( completionCallback ) completionCallback ( ) ;
49- } else {
50- if ( errorCallback ) errorCallback ( result ) ;
51- }
45+ parseWeather ( event . resp ) ;
46+ if ( completionCallback ) completionCallback ( ) ;
5247 } ) . catch ( ( e ) => {
5348 if ( errorCallback ) errorCallback ( e ) ;
5449 } ) ;
You can’t perform that action at this time.
0 commit comments