Skip to content

Commit

Permalink
Add Null Check for OWM
Browse files Browse the repository at this point in the history
  • Loading branch information
leoherzog committed Jan 1, 2025
1 parent 149100e commit c96bf0c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions code.gs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ function updateOpenWeatherMap_() {

const stationsDetails = JSON.parse(UrlFetchApp.fetch('https://api.openweathermap.org/data/3.0/stations?APPID=' + openWeatherMapAPIKey).getContentText());
const internalStationID = stationsDetails.find(station => station['external_id'] == openWeatherMapStationID)['id'];
if (!internalStationID) throw 'Station ' + openWeatherMapStationID + ' not found in this OpenWeatherMap account';

let measurements = {"station_id": internalStationID};
measurements['dt'] = (conditions.time / 1000).toFixedNumber(0);
Expand Down

0 comments on commit c96bf0c

Please sign in to comment.