diff --git a/ipmd/static/ipmd/js/ipmdlib.js b/ipmd/static/ipmd/js/ipmdlib.js index 043717d4f713f9d4967e926fb8c07775a6e072a4..402b96244e4bf3e0097528f0f3ba5e6b75d96767 100644 --- a/ipmd/static/ipmd/js/ipmdlib.js +++ b/ipmd/static/ipmd/js/ipmdlib.js @@ -154,7 +154,17 @@ async function getStationWeatherData(endpoint, weatherStationId, parameters, int + "&weatherStationId=" + weatherStationId + "¶meters=" + parameters.join(",") ); - return await response.json(); + + if(response.status == 200) + { + return await response.json(); + } + else + { + let errorMessage = "No weather data was returned. Message from the data source was: \n\n" + await response.text(); + alert(errorMessage); + return null; + } } /** @@ -177,7 +187,18 @@ async function getLocationWeatherData(endpoint, longitude, latitude, parameters, + "&latitude=" + latitude + "¶meters=" + parameters.join(",") ); - return (response.status == 200) ? await response.json() : null; + + if(response.status == 200) + { + return await response.json(); + } + else + { + let errorMessage = "No weather data was returned. Message from the data source was: \n\n" + await response.text(); + alert(errorMessage); + return null; + } + } /**