Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sivel/speedtest-cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Martz <matt@sivel.net>2018-02-14 01:21:57 +0300
committerMatt Martz <matt@sivel.net>2018-02-14 01:21:57 +0300
commit35c3ee20edbd19bb89a9b7b468b08a0a30566012 (patch)
tree105400613e225077c76753d03cc17d4c07d06dab
parent0a7823db7acb895765f074261b01c6d1950b8a49 (diff)
Exit with nicer error if lat/lon is not valid
-rwxr-xr-xspeedtest.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/speedtest.py b/speedtest.py
index 359224c..c92a791 100755
--- a/speedtest.py
+++ b/speedtest.py
@@ -1119,7 +1119,13 @@ class Speedtest(object):
'upload_max': upload_count * size_count
})
- self.lat_lon = (float(client['lat']), float(client['lon']))
+ try:
+ self.lat_lon = (float(client['lat']), float(client['lon']))
+ except ValueError:
+ raise SpeedtestConfigError(
+ 'Unknown location: lat=%r lon=%r' %
+ (client.get('lat'), client.get('lon'))
+ )
printer('Config:\n%r' % self.config, debug=True)