diff --git a/api/src/multiaccessy/accessy.py b/api/src/multiaccessy/accessy.py index dc951f5cb..6682103e8 100644 --- a/api/src/multiaccessy/accessy.py +++ b/api/src/multiaccessy/accessy.py @@ -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