Move exception classes higher in the file

This commit is contained in:
Matt Martz 2014-03-10 11:28:22 -05:00
parent 989c440700
commit de594188e5
1 changed files with 60 additions and 53 deletions

View File

@ -197,6 +197,66 @@ def print_dots(current, total, start=False, end=False):
sys.stdout.flush() sys.stdout.flush()
class SpeedtestException(Exception):
"""Base exception for this module"""
pass
class ConfigRetrievalError(SpeedtestException):
"""Could not retrieve config.php"""
pass
class ServersRetrievalError(SpeedtestException):
"""Could not retrieve speedtest-servers.php"""
pass
class InvalidServerIDType(SpeedtestException):
"""Server ID used for filtering was not an integer"""
pass
class NoMatchedServers(SpeedtestException):
"""No servers matched when filtering"""
pass
class SpeedtestMiniConnectFailure(SpeedtestException):
"""Could not connect to the provided speedtest mini server"""
pass
class InvalidSpeedtestMiniServer(SpeedtestException):
"""Server provided as a speedtest mini server does not actually appear
to be a speedtest mini server
"""
pass
class ShareResultsConnectFailure(SpeedtestException):
"""Could not connect to speedtest.net API to POST results"""
pass
class ShareResultsSubmitFailure(SpeedtestException):
"""Unable to successfully POST results to speedtest.net API after
connection
"""
pass
class SpeedtestUploadTimeout(SpeedtestException):
"""testlength configuration reached during upload
Used to ensure the upload halts when no additional data should be sent
"""
pass
class HTTPDownloader(threading.Thread): class HTTPDownloader(threading.Thread):
"""Thread class for retrieving a URL""" """Thread class for retrieving a URL"""
@ -225,10 +285,6 @@ class HTTPDownloader(threading.Thread):
pass pass
class SpeedtestUploadTimeout(Exception):
pass
class HTTPUploaderData(object): class HTTPUploaderData(object):
def __init__(self, length, start, timeout): def __init__(self, length, start, timeout):
self.length = length self.length = length
@ -283,55 +339,6 @@ class HTTPUploader(threading.Thread):
self.result = sum(self.data.total) self.result = sum(self.data.total)
class SpeedtestException(Exception):
"""Base exception for this module"""
pass
class ConfigRetrievalError(SpeedtestException):
"""Could not retrieve config.php"""
pass
class ServersRetrievalError(SpeedtestException):
"""Could not retrieve speedtest-servers.php"""
pass
class InvalidServerIDType(SpeedtestException):
"""Server ID used for filtering was not an integer"""
pass
class NoMatchedServers(SpeedtestException):
"""No servers matched when filtering"""
pass
class SpeedtestMiniConnectFailure(SpeedtestException):
"""Could not connect to the provided speedtest mini server"""
pass
class InvalidSpeedtestMiniServer(SpeedtestException):
"""Server provided as a speedtest mini server does not actually appear
to be a speedtest mini server
"""
pass
class ShareResultsConnectFailure(SpeedtestException):
"""Could not connect to speedtest.net API to POST results"""
pass
class ShareResultsSubmitFailure(SpeedtestException):
"""Unable to successfully POST results to speedtest.net API after
connection
"""
pass
class SpeedtestResults(object): class SpeedtestResults(object):
"""Class for holding the results of a speedtest, including: """Class for holding the results of a speedtest, including: