about summary refs log tree commit diff
path: root/gn2/wqflask/oauth2
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2024-09-06 10:45:41 -0500
committerFrederick Muriuki Muriithi2024-09-06 10:45:41 -0500
commit570410a0e8a18099a53f412c0016962d7607ab71 (patch)
treef458d8ba639ebcb85f7c78635b54608f206766ce /gn2/wqflask/oauth2
parent435a201483f96054e2ecdcbcfc97d79a93867f88 (diff)
downloadgenenetwork2-570410a0e8a18099a53f412c0016962d7607ab71.tar.gz
Fail noisily to help with troubleshooting issues.
Diffstat (limited to 'gn2/wqflask/oauth2')
-rw-r--r--gn2/wqflask/oauth2/request_utils.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/gn2/wqflask/oauth2/request_utils.py b/gn2/wqflask/oauth2/request_utils.py
index 456aba2b..167d0cbd 100644
--- a/gn2/wqflask/oauth2/request_utils.py
+++ b/gn2/wqflask/oauth2/request_utils.py
@@ -24,9 +24,15 @@ def authserver_authorise_uri():
 
 
 def user_details():
-    return oauth2_get("auth/user/").either(
-        lambda err: {},
-        lambda usr_dets: usr_dets)
+    def __handle_error__(err):
+        error = process_error(err)
+        msg = (
+            f"Error from AUTH Server:\n\nError:\t{error['error']}\n\n"
+            f"{error['error-trace']}\nStatus Code:\t{error['status_code']}\n\n")
+        app.logger.error(msg)
+        raise Exception(msg)
+    return oauth2_get("auth/user/").either(__handle_error__,
+                                           lambda usr_dets: usr_dets)
 
 def process_error(error: Response,
                   message: str=("Requested endpoint was not found on the API "