Add some assertions for 'successful'.
This commit is contained in:
parent
b1d6e70c8b
commit
2a95533564
@ -159,6 +159,7 @@ class DownloadItem(QObject):
|
|||||||
|
|
||||||
def _die(self, msg):
|
def _die(self, msg):
|
||||||
"""Abort the download and emit an error."""
|
"""Abort the download and emit an error."""
|
||||||
|
assert not self.successful
|
||||||
self._reply.downloadProgress.disconnect()
|
self._reply.downloadProgress.disconnect()
|
||||||
self._reply.finished.disconnect()
|
self._reply.finished.disconnect()
|
||||||
self._reply.error.disconnect()
|
self._reply.error.disconnect()
|
||||||
@ -204,6 +205,7 @@ class DownloadItem(QObject):
|
|||||||
system = config.get('colors', 'downloads.bg.system')
|
system = config.get('colors', 'downloads.bg.system')
|
||||||
error = config.get('colors', 'downloads.bg.error')
|
error = config.get('colors', 'downloads.bg.error')
|
||||||
if self.error_msg is not None:
|
if self.error_msg is not None:
|
||||||
|
assert not self.successful
|
||||||
return error
|
return error
|
||||||
elif self._percentage() is None:
|
elif self._percentage() is None:
|
||||||
return start
|
return start
|
||||||
@ -537,8 +539,10 @@ class DownloadManager(QAbstractListModel):
|
|||||||
data = item
|
data = item
|
||||||
elif role == Qt.ToolTipRole:
|
elif role == Qt.ToolTipRole:
|
||||||
if item.error_msg is None:
|
if item.error_msg is None:
|
||||||
|
assert item.successful
|
||||||
data = QVariant()
|
data = QVariant()
|
||||||
else:
|
else:
|
||||||
|
assert not item.successful
|
||||||
return item.error_msg
|
return item.error_msg
|
||||||
else:
|
else:
|
||||||
data = QVariant()
|
data = QVariant()
|
||||||
|
Loading…
Reference in New Issue
Block a user