Handle no valid data states

This commit is contained in:
Samer Albahra
2018-05-24 08:20:19 -05:00
parent e76ae423a9
commit 6d8c355869

View File

@@ -430,7 +430,12 @@ exports.getWeather = function( req, res ) {
// and also calculate if a restriction is met to prevent watering.
finishRequest = function( weather ) {
if ( !weather ) {
getTimeData( location, finishRequest );
if ( typeof location[ 0 ] === "number" && typeof location[ 1 ] === "number" ) {
getTimeData( location, finishRequest );
} else {
res.send( "Error: No weather data found." );
}
return;
}