mirror of
https://github.com/PaiGramTeam/StarRailDamageCal.git
synced 2024-11-27 18:04:08 +00:00
add InvalidUidError
This commit is contained in:
parent
624236672e
commit
fae0b02574
@ -8,6 +8,13 @@ class UidNotfoundError(Exception):
|
||||
def __str__(self):
|
||||
return self.uid
|
||||
|
||||
class InvalidUidError(Exception):
|
||||
def __init__(self, uid: str):
|
||||
self.uid = uid
|
||||
|
||||
def __str__(self):
|
||||
return self.uid
|
||||
|
||||
|
||||
class CharNameError(Exception):
|
||||
def __init__(self, char_name: str):
|
||||
|
@ -7,7 +7,11 @@ import msgspec
|
||||
from httpx import AsyncClient
|
||||
from msgspec import convert
|
||||
|
||||
from starrail_damage_cal.exception import MihomoModelError, MihomoQueueTimeoutError
|
||||
from starrail_damage_cal.exception import (
|
||||
InvalidUidError,
|
||||
MihomoModelError,
|
||||
MihomoQueueTimeoutError,
|
||||
)
|
||||
from starrail_damage_cal.mihomo.models import MihomoData
|
||||
|
||||
_HEADER = {"User-Agent": "StarRailDamageCal/"}
|
||||
@ -33,6 +37,8 @@ async def get_char_card_info(
|
||||
except msgspec.ValidationError as e:
|
||||
if req.text == '{"detail":"Queue timeout"}':
|
||||
raise MihomoQueueTimeoutError from e
|
||||
if req.text == '{"detail":"Invalid uid"}':
|
||||
raise InvalidUidError(uid) from e
|
||||
raise MihomoModelError(e) from e
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
raise MihomoModelError(e) from e
|
||||
|
Loading…
Reference in New Issue
Block a user