We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f943c47 commit 2cf797bCopy full SHA for 2cf797b
src/scaup/auth/micro.py
@@ -1,3 +1,4 @@
1
+from json import JSONDecodeError
2
from typing import List, TypeVar
3
4
import requests
@@ -46,7 +47,11 @@ def _get_user(token: str):
46
47
)
48
49
if response.status_code != 200:
- raise HTTPException(status_code=response.status_code, detail=response.json().get("detail"))
50
+ try:
51
+ raise HTTPException(status_code=response.status_code, detail=response.json().get("detail"))
52
+ except JSONDecodeError:
53
+ app_logger.error(f"Microauth returned {response.status_code}: {response.text}")
54
+ raise HTTPException(status_code=response.status_code, detail="Failed to fetch user info from Microauth")
55
return response.json()
56
57
0 commit comments