aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-02-14 15:41:02 +0300
committerBonfaceKilz2024-02-14 16:07:26 +0300
commit500390a6ff2f2499a0f4bd6ae983dca93b0ec4f8 (patch)
tree93b19772e2a3d63e11483e83f2cfcdf0fe093de9 /gn3
parent002f6374ba8f447cbcf544bd82ef4bd53f95c5a0 (diff)
downloadgenenetwork3-500390a6ff2f2499a0f4bd6ae983dca93b0ec4f8.tar.gz
Minor pep-8 fixes.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3')
-rw-r--r--gn3/errors.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/gn3/errors.py b/gn3/errors.py
index 3a2f781..806d143 100644
--- a/gn3/errors.py
+++ b/gn3/errors.py
@@ -18,6 +18,7 @@ from authlib.oauth2.rfc6749.errors import OAuth2Error
from gn3.auth.authorisation.errors import AuthorisationError
+
def add_trace(exc: Exception, jsonmsg: dict) -> dict:
"""Add the traceback to the error handling object."""
return {
@@ -33,6 +34,7 @@ def page_not_found(pnf):
"error_description": pnf.description
})), 404
+
def internal_server_error(pnf):
"""Generic 404 handler."""
return jsonify(add_trace(pnf, {
@@ -49,6 +51,7 @@ def handle_authorisation_error(exc: AuthorisationError):
"error_description": " :: ".join(exc.args)
})), exc.error_code
+
def handle_oauth2_errors(exc: OAuth2Error):
"""Handle OAuth2Error if not handled anywhere else."""
current_app.logger.error(exc)
@@ -57,6 +60,7 @@ def handle_oauth2_errors(exc: OAuth2Error):
"error_description": exc.description,
})), exc.status_code
+
def handle_sqlite3_errors(exc: OperationalError):
"""Handle sqlite3 errors if not handled anywhere else."""
current_app.logger.error(exc)
@@ -65,6 +69,7 @@ def handle_sqlite3_errors(exc: OperationalError):
"error_description": exc.args[0],
}), 500
+
def handle_sparql_errors(exc: SPARQLWrapperException):
"""Handle sqlite3 errors if not handled anywhere else."""
current_app.logger.error(exc)