aboutsummaryrefslogtreecommitdiff
path: root/qc_app
diff options
context:
space:
mode:
Diffstat (limited to 'qc_app')
-rw-r--r--qc_app/errors.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/qc_app/errors.py b/qc_app/errors.py
index 902e7e0..06c5dd4 100644
--- a/qc_app/errors.py
+++ b/qc_app/errors.py
@@ -5,12 +5,14 @@ import traceback
import MySQLdb as mdb
from flask import Flask, render_template
-def handle_general_exception(exc: Exception):
+def handle_general_exception(_exc: Exception):
+ """Handle generic exceptions."""
trace = traceback.format_exc()
logging.error("Error: Generic unhandled exception!!\n%s", trace)
return render_template("unhandled_exception.html", trace=trace)
-def handle_general_MySQLdb_errors(exc: mdb.MySQLError):
+def handle_general_mysqldb_errors(_exc: mdb.MySQLError):
+ """Handle MySQLdb errors."""
trace = traceback.format_exc()
logging.error("MySQLError: Generic MySQL Error!!\n%s", trace)
return render_template("unhandled_exception.html", trace=trace)
@@ -18,4 +20,4 @@ def handle_general_MySQLdb_errors(exc: mdb.MySQLError):
def register_error_handlers(app: Flask):
"""Register top-level error/exception handlers."""
app.register_error_handler(Exception, handle_general_exception)
- app.register_error_handler(mdb.MySQLError, handle_general_exception)
+ app.register_error_handler(mdb.MySQLError, handle_general_mysqldb_errors)