commit 3700228e3d12d56b222e02e3e09db617be1ea966
parent 13458961bff0694b8cea76526c7ffd138981764e
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Mon, 25 Nov 2013 15:57:36 +0100
Exiting with error when no weather data exist for a given location
Diffstat:
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -146,6 +146,14 @@ then
exit
fi
+status_code=$(echo $weather | jq -r '.cod')
+
+if [ $status_code != 200 ]
+then
+ echo "ERROR : Cannot fetch weather data for the given location"
+ exit
+fi
+
###[ Process Weather data ]####################################################