only declare rows deleted if they're the result of a NotFound error

If it's some other error like the DB suddenly becoming accessible,
we don't want to scare the user into thinking their data was deleted,
and we want to know what the error was without popping up tens of
message boxes for each row.
This commit is contained in:
Damien Elmes 2021-03-23 19:04:01 +10:00
parent ff0d346927
commit 9c456dd7b0

View File

@ -200,8 +200,10 @@ class DataModel(QAbstractTableModel):
def _fetch_row_from_backend(self, cid: int) -> CellRow: def _fetch_row_from_backend(self, cid: int) -> CellRow:
try: try:
return CellRow(*self.col.browser_row_for_card(cid)) return CellRow(*self.col.browser_row_for_card(cid))
except: except NotFoundError:
return CellRow.deleted(len(self.activeCols)) return CellRow.deleted(len(self.activeCols))
except Exception as e:
return CellRow.generic(len(self.activeCols), str(e))
def getCard(self, index: QModelIndex) -> Optional[Card]: def getCard(self, index: QModelIndex) -> Optional[Card]:
"""Try to return the indicated, possibly deleted card.""" """Try to return the indicated, possibly deleted card."""