From f902f1df0cc73b71fcdda65950fbd2b527baaf12 Mon Sep 17 00:00:00 2001 From: Dakota Date: Mon, 5 Aug 2024 16:03:03 +0200 Subject: [PATCH] fix: added exception to user class --- pyZUnivers/user.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyZUnivers/user.py b/pyZUnivers/user.py index b9409ff..fa3bce6 100644 --- a/pyZUnivers/user.py +++ b/pyZUnivers/user.py @@ -62,7 +62,10 @@ class User: def __init__(self, username : str) -> None: self.name, self.__parsed_name = parse_username(username) - self.__base_infos: Base = get_datas(f"{API_BASE_URL}/user/{self.__parsed_name}") + try: + self.__base_infos: Base = get_datas(f"{API_BASE_URL}/user/{self.__parsed_name}") + except ResourceNotFoundError: + raise UserNotFound(self.name) self.__user = self.__base_infos['user'] self.__leaderboards = self.__base_infos['leaderboards']