From 500390a6ff2f2499a0f4bd6ae983dca93b0ec4f8 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 14 Feb 2024 15:41:02 +0300 Subject: Minor pep-8 fixes. Signed-off-by: Munyoki Kilyungi --- gn3/errors.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gn3') 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) -- cgit v1.2.3