Files
scotus-watch/lib/utils.py
2025-02-07 17:22:24 -05:00

19 lines
551 B
Python

from typing import NoReturn
from PySide6.QtCore import QCoreApplication
from PySide6.QtSql import QSqlQuery
translate = QCoreApplication.translate
def query_error(query: QSqlQuery) -> NoReturn:
"""Standarized query error reporter."""
print(
translate("MainWindow", "SQL Error:\n")
+ "{}\n{}\n{}:{}".format(
query.executedQuery(),
query.boundValues(),
query.lastError().type(),
query.lastError().text(),
)
)
raise Exception(translate("MainWindow", "SQL Error"))