Files
esl-reader/lib/utils.py
Christopher T. Johnson 7f01c8d040 Setup LSP and clear all lint
2024-03-11 17:06:25 -04:00

22 lines
574 B
Python

"""Utility Functions."""
from typing import NoReturn
from PyQt6.QtCore import QCoreApplication
from PyQt6.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"))