Update dashboard.py

This commit is contained in:
Donald Zou 2024-12-27 03:09:27 +08:00
parent e58b1d670b
commit 9bd394f351

View File

@ -1629,10 +1629,12 @@ def sqlSelect(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
try: try:
cursor = sqldb.cursor() cursor = sqldb.cursor()
return cursor.execute(statement, paramters) return cursor.execute(statement, paramters)
except sqlite3.OperationalError as error: except sqlite3.OperationalError as error:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement) print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
return [] return []
except Exception as e:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
return []
def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor: def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
@ -1645,6 +1647,9 @@ def sqlUpdate(statement: str, paramters: tuple = ()) -> sqlite3.Cursor:
sqldb.commit() sqldb.commit()
except sqlite3.OperationalError as error: except sqlite3.OperationalError as error:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement) print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
except Exception as e:
print("[WGDashboard] SQLite Error:" + str(error) + " | Statement: " + statement)
return []
DashboardConfig = DashboardConfig() DashboardConfig = DashboardConfig()
_, APP_PREFIX = DashboardConfig.GetConfig("Server", "app_prefix") _, APP_PREFIX = DashboardConfig.GetConfig("Server", "app_prefix")