Skip to content

Commit

Permalink
Improve error message on the client
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburr committed Sep 28, 2023
1 parent 251a05d commit 16654b5
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/DIRAC/FrameworkSystem/Service/ProxyManagerHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,21 @@ def export_exchangeProxyForToken(self):
group = credDict["group"]
scopes = [f"vo:{vo}", f"group:{group}"] + [f"property:{prop}" for prop in dirac_properties]

r = requests.get(
f"{diracxUrl}/auth/legacy-exchange",
params={
"preferred_username": credDict["username"],
"scope": " ".join(scopes),
},
headers={"Authorization": f"Bearer {apiKey}"},
)
try:
r = requests.get(
f"{diracxUrl}/auth/legacy-exchange",
params={
"preferred_username": credDict["username"],
"scope": " ".join(scopes),
},
headers={"Authorization": f"Bearer {apiKey}"},
)
except requests.exceptions.RequestException as exc:
return S_ERROR(f"Failed to contact DiracX: {exc}")
else:
if not r.ok:
return S_ERROR(f"Failed to contact DiracX: {r.status_code} {r.text}")

r.raise_for_status()
return S_OK(r.json())


Expand Down

0 comments on commit 16654b5

Please sign in to comment.