aboutsummaryrefslogtreecommitdiff
path: root/qc_app/errors.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-11-30 09:58:23 +0300
committerFrederick Muriuki Muriithi2023-11-30 09:58:23 +0300
commit3b725c7354b185cc748f1d8ebfac6bab5e17b4aa (patch)
tree9154564b1ee696b1a954c1052a1e050bab7cd544 /qc_app/errors.py
parentc26b9acc8d51bb5efe4e50114a6c723552e27a5f (diff)
downloadgn-uploader-3b725c7354b185cc748f1d8ebfac6bab5e17b4aa.tar.gz
Fix errors caught by pylint and mypy.
Diffstat (limited to 'qc_app/errors.py')
-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)