22 lines
574 B
Python
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"))
|