Skip to content

Commit

Permalink
Better error handling when accessing the Accessy API.
Browse files Browse the repository at this point in the history
  • Loading branch information
HalfVoxel committed Dec 3, 2024
1 parent 2830aca commit 4a54d9f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion api/src/multiaccessy/accessy.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,11 @@ def _get_json_paginated(self, url: str, msg: str | None = None) -> list[Any]:

def get_user_details(self, user_id: UUID) -> AccessyUser:
"""Get details for user ID."""
return AccessyUser.from_dict(self._get_user_details(user_id))
json = self._get_user_details(user_id)
try:
return AccessyUser.from_dict(json)
except Exception as e:
raise AccessyError(f"Could not get user details for {user_id}. Could not deserialize {json} as an AccessyUser") from e

################################################
# Methods that return raw JSON data from API:s
Expand Down

0 comments on commit 4a54d9f

Please sign in to comment.