diff options
Diffstat (limited to 'gn2/wqflask')
-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 " |