aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-04-19 16:16:28 +0300
committerFrederick Muriuki Muriithi2023-04-19 16:16:28 +0300
commita54b212bc3a64ca364d1f2e3245ffdab71c9ee93 (patch)
tree6345eb04f5e42d4c1cb1ae2fc698d5e02f6ee8e3
parente72ee8b00d0e2d0456f05160916211a1536054c8 (diff)
downloadgenenetwork2-a54b212bc3a64ca364d1f2e3245ffdab71c9ee93.tar.gz
oauth2: fix bug with error handling.
-rw-r--r--wqflask/wqflask/oauth2/request_utils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/wqflask/wqflask/oauth2/request_utils.py b/wqflask/wqflask/oauth2/request_utils.py
index fae3a347..0cd1697b 100644
--- a/wqflask/wqflask/oauth2/request_utils.py
+++ b/wqflask/wqflask/oauth2/request_utils.py
@@ -1,6 +1,7 @@
"""General request utilities"""
from typing import Optional
+import simplejson
from flask import (
flash, session, url_for, redirect, Response, render_template,
current_app as app)
@@ -20,7 +21,10 @@ def process_error(error: Response,
"server.")
) -> dict:
if error.status_code == 404:
- msg = error.json()["error_description"] if hasattr(error, "json") else message
+ try:
+ msg = error.json()["error_description"]
+ except simplejson.errors.JSONDecodeError as _jde:
+ msg = message
return {
"error": "NotFoundError",
"error_message": msg,