Example #1
0
File: model.py Project: v-limc/anki
    def _fetch_row_from_backend(self, item: ItemId) -> CellRow:
        try:
            row = CellRow(*self.col.browser_row_for_id(item))
        except NotFoundError:
            return CellRow.deleted(self.len_columns())
        except Exception as e:
            return CellRow.generic(self.len_columns(), str(e))

        gui_hooks.browser_did_fetch_row(item, self._state.is_notes_mode(), row,
                                        self._state.active_columns)
        return row
Example #2
0
File: model.py Project: rye761/anki
    def _fetch_row_from_backend(self, item: ItemId) -> CellRow:
        try:
            row = CellRow(*self.col.browser_row_for_id(item))
        except NotFoundError:
            return CellRow.deleted(self.len_columns())
        except Exception as e:
            return CellRow.generic(self.len_columns(), str(e))
        except BaseException as e:
            # fatal error like a panic in the backend - dump it to the
            # console so it gets picked up by the error handler
            import traceback

            traceback.print_exc()
            # and prevent Qt from firing a storm of follow-up errors
            self._block_updates = True
            return CellRow.generic(self.len_columns(), "error")

        gui_hooks.browser_did_fetch_row(item, self._state.is_notes_mode(), row,
                                        self._state.active_columns)
        return row