Files
scotus-watch/lib/utils.py
Christopher T. Johnson 488203d868 Lint
2025-02-08 16:42:19 -05:00

21 lines
553 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"))