From 9c456dd7b0407ab223c1e0e18076c56ed9f897ce Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 23 Mar 2021 19:04:01 +1000 Subject: [PATCH] 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. --- qt/aqt/browser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index 76b7a7e18..5bac052ef 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -200,8 +200,10 @@ class DataModel(QAbstractTableModel): def _fetch_row_from_backend(self, cid: int) -> CellRow: try: return CellRow(*self.col.browser_row_for_card(cid)) - except: + except NotFoundError: 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]: """Try to return the indicated, possibly deleted card."""