diff options
-rw-r--r-- | gn3/errors.py | 5 |
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) |