Exit with nicer error if lat/lon is not valid

This commit is contained in:
Matt Martz 2018-02-13 16:21:57 -06:00
parent 0a7823db7a
commit 35c3ee20ed
1 changed files with 7 additions and 1 deletions

View File

@ -1119,7 +1119,13 @@ class Speedtest(object):
'upload_max': upload_count * size_count 'upload_max': upload_count * size_count
}) })
try:
self.lat_lon = (float(client['lat']), float(client['lon'])) 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) printer('Config:\n%r' % self.config, debug=True)