diff options
author | John Nduli | 2024-07-31 11:34:26 +0300 |
---|---|---|
committer | BonfaceKilz | 2024-09-17 11:37:43 +0300 |
commit | e86a6a9d254df6c041c14edcb15a03e7bdb73ee2 (patch) | |
tree | b707a22034616a30cb367e96212787cc8274c73f | |
parent | b09faa4b5055fd773891ed819f0503165167892e (diff) | |
download | genenetwork2-e86a6a9d254df6c041c14edcb15a03e7bdb73ee2.tar.gz |
fix: dynamically get the keys that may contain error messages
-rw-r--r-- | gn2/wqflask/oauth2/request_utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gn2/wqflask/oauth2/request_utils.py b/gn2/wqflask/oauth2/request_utils.py index 167d0cbd..673a7da9 100644 --- a/gn2/wqflask/oauth2/request_utils.py +++ b/gn2/wqflask/oauth2/request_utils.py @@ -41,8 +41,10 @@ def process_error(error: Response, if error.status_code in range(400, 500): try: err = error.json() - msg = err.get( - "error_message", err.get("error_description", f"{error.reason}")) + potential_keys = [key for key in err.keys() if key.startswith("error")] + msg = f"{error.reason}" + if potential_keys: + msg = " ; ".join([f"{k}: {err[k]}" for k in potential_keys]) except simplejson.errors.JSONDecodeError as _jde: msg = message return { |