From 28688ce5ab188c15955dcd3dabd5785fe923f055 Mon Sep 17 00:00:00 2001 From: JokelBaf <60827680+JokelBaf@users.noreply.github.com> Date: Sat, 20 Jan 2024 05:47:09 +0200 Subject: [PATCH] Add clearer error for an empty string in cookie value when accessing `user_id` --- genshin/client/manager/managers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/genshin/client/manager/managers.py b/genshin/client/manager/managers.py index 450b21a4..fceb4ca5 100644 --- a/genshin/client/manager/managers.py +++ b/genshin/client/manager/managers.py @@ -249,6 +249,9 @@ def user_id(self) -> typing.Optional[int]: """ for name, value in self.cookies.items(): if name in ("ltuid", "account_id", "ltuid_v2", "account_id_v2"): + if not value: + raise ValueError(f"{name} can not be an empty string.") + return int(value) return None