1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-06 07:50:13 +01:00

Merge pull request #433 from reloadlife/patch-1

Added a try/catch statement to prevent panel from crashing #432
This commit is contained in:
Donald Zou 2024-10-21 15:37:49 +08:00 committed by GitHub
commit 4546e795ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1423,8 +1423,13 @@ cursor = sqldb.cursor()
def sqlSelect(statement: str, paramters: tuple = ()) -> sqlite3.Cursor: def sqlSelect(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
with sqldb: with sqldb:
try:
cursor = sqldb.cursor() cursor = sqldb.cursor()
return cursor.execute(statement, paramters) return cursor.execute(statement, paramters)
# temo fix for https://github.com/donaldzou/WGDashboard/issues/432
except sqlite3.DatabaseError as e:
print(f"Database error occurred: {e}")
return []
def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor: def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
with sqldb: with sqldb: