diff options
author | Frederick Muriuki Muriithi | 2024-09-06 10:45:41 -0500 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2024-09-06 10:45:41 -0500 |
commit | 570410a0e8a18099a53f412c0016962d7607ab71 (patch) | |
tree | f458d8ba639ebcb85f7c78635b54608f206766ce | |
parent | 435a201483f96054e2ecdcbcfc97d79a93867f88 (diff) | |
download | genenetwork2-570410a0e8a18099a53f412c0016962d7607ab71.tar.gz |
Fail noisily to help with troubleshooting issues.
-rw-r--r-- | gn2/wqflask/oauth2/request_utils.py | 12 |
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 " |