about summary refs log tree commit diff
diff options
context:
space:
mode:
-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,