Make SlowConnError private

This commit is contained in:
alessandro90
2019-06-28 20:21:11 +02:00
parent 9c0b93cb32
commit 9ebf75c0fb

View File

@@ -24,7 +24,7 @@ class ThreadStatus(Enum):
SLOW_CONN_ERR = auto() SLOW_CONN_ERR = auto()
class SlowConnError(Exception): class _SlowConnError(Exception):
pass pass
@@ -92,7 +92,7 @@ class DownloadThread(BaseDownloadThread):
try: try:
data = self._db.read(self._CHUNK) data = self._db.read(self._CHUNK)
except Exception: except Exception:
raise SlowConnError raise _SlowConnError
else: else:
delta = perf_counter() - start delta = perf_counter() - start
if not data: if not data:
@@ -108,7 +108,7 @@ class DownloadThread(BaseDownloadThread):
return return
except Exception as e: # No (or bad) internet connection. except Exception as e: # No (or bad) internet connection.
self._db.release_conn() self._db.release_conn()
if isinstance(e, SlowConnError): if isinstance(e, _SlowConnError):
self.status = ThreadStatus.SLOW_CONN_ERR self.status = ThreadStatus.SLOW_CONN_ERR
else: else:
self.status = ThreadStatus.NO_CONNECTION_ERR self.status = ThreadStatus.NO_CONNECTION_ERR