From 13c14ade387e78e290267c055f24b035c9e2868c Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 1 Aug 2024 15:07:02 -0500 Subject: Handle generic exception and return a value. --- gn_auth/auth/authorisation/resources/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gn_auth/auth/authorisation/resources/views.py b/gn_auth/auth/authorisation/resources/views.py index d8ac431..19d3d9a 100644 --- a/gn_auth/auth/authorisation/resources/views.py +++ b/gn_auth/auth/authorisation/resources/views.py @@ -440,6 +440,14 @@ def resources_authorisation(): "Expected a JSON object with a 'resource-ids' key.") }) resp.status_code = 400 + except Exception as _exc: + app.logger.debug("Generic exception.", exc_info=True) + resp = jsonify({ + "status": "general-exception", + "error_description": ( + "Failed to fetch the user's privileges.") + }) + resp.status_code = 500 return resp -- cgit v1.2.3