commit 343b65a2a4749c87ed1fcdb3477d51e5b0066c6d
parent 08fe7c3bde09ac5f0d9ad65a6b59e3b902705a27
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Mon, 25 Nov 2013 15:01:47 +0100
Exiting with error when weather data cannot be fetch
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -140,6 +140,14 @@ fetch_cmd=$(get_config "fetch_cmd" || echo "curl -s")
api_cmd=$([[ $forecast != 0 ]] && echo "forecast/daily" || echo "weather")
weather=$($fetch_cmd "http://api.openweathermap.org/data/2.5/$api_cmd?q=$location\&units=$units")
+if [ -z "$weather" ]
+then
+ echo "ERROR : Cannot fetch weather data"
+ exit
+fi
+
+
+
###[ Process Weather data ]####################################################
function epoch_to_date {