Added error handling to DBContext

This commit is contained in:
Sven Heidemann 2022-07-19 14:23:17 +02:00
parent 4bcab95369
commit a3512b56d7

View File

@ -30,4 +30,8 @@ class DBContext(DatabaseContext):
self._logger.error(__name__, "Saving changes failed", e) self._logger.error(__name__, "Saving changes failed", e)
def select(self, statement: str) -> list[tuple]: def select(self, statement: str) -> list[tuple]:
try:
return super(DBContext, self).select(statement) return super(DBContext, self).select(statement)
except Exception as e:
self._logger.error(__name__, f'Database error caused by {statement}', e)
return []