Fix except blocks using HTTP_ERRORS
The except blocks involving HTTP_ERRORS joined the exception types in a way that the types listed in HTTP_ERRORS appeared as a tuple, e.g. (ServersRetrievalError, (HTTPError, …))
This commit is contained in:
parent
6603954e45
commit
16746b775a
|
@ -1395,14 +1395,14 @@ def shell():
|
||||||
printer('Retrieving speedtest.net configuration...', quiet)
|
printer('Retrieving speedtest.net configuration...', quiet)
|
||||||
try:
|
try:
|
||||||
speedtest = Speedtest()
|
speedtest = Speedtest()
|
||||||
except (ConfigRetrievalError, HTTP_ERRORS):
|
except ((ConfigRetrievalError,) + HTTP_ERRORS):
|
||||||
printer('Cannot retrieve speedtest configuration')
|
printer('Cannot retrieve speedtest configuration')
|
||||||
raise SpeedtestCLIError(get_exception())
|
raise SpeedtestCLIError(get_exception())
|
||||||
|
|
||||||
if args.list:
|
if args.list:
|
||||||
try:
|
try:
|
||||||
speedtest.get_servers()
|
speedtest.get_servers()
|
||||||
except (ServersRetrievalError, HTTP_ERRORS):
|
except ((ServersRetrievalError,) + HTTP_ERRORS):
|
||||||
print_('Cannot retrieve speedtest server list')
|
print_('Cannot retrieve speedtest server list')
|
||||||
raise SpeedtestCLIError(get_exception())
|
raise SpeedtestCLIError(get_exception())
|
||||||
|
|
||||||
|
@ -1432,7 +1432,7 @@ def shell():
|
||||||
speedtest.get_servers(servers)
|
speedtest.get_servers(servers)
|
||||||
except NoMatchedServers:
|
except NoMatchedServers:
|
||||||
raise SpeedtestCLIError('No matched servers: %s' % args.server)
|
raise SpeedtestCLIError('No matched servers: %s' % args.server)
|
||||||
except (ServersRetrievalError, HTTP_ERRORS):
|
except ((ServersRetrievalError,) + HTTP_ERRORS):
|
||||||
print_('Cannot retrieve speedtest server list')
|
print_('Cannot retrieve speedtest server list')
|
||||||
raise SpeedtestCLIError(get_exception())
|
raise SpeedtestCLIError(get_exception())
|
||||||
except InvalidServerIDType:
|
except InvalidServerIDType:
|
||||||
|
|
Loading…
Reference in New Issue