Skip to content
Snippets Groups Projects
Commit 11c7bfc8 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Add any error message from the weather datasource

parent b4c5b687
Branches
No related tags found
2 merge requests!17Saddlegallmidge form idec 372,!12feat: Add test page (spatial) with mapserver layer in openlayers map
This commit is part of merge request !17. Comments created here will be created in the context of that merge request.
......@@ -154,7 +154,17 @@ async function getStationWeatherData(endpoint, weatherStationId, parameters, int
+ "&weatherStationId=" + weatherStationId
+ "&parameters=" + 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
+ "&parameters=" + 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;
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment