StarRailDamageCal/starrail_damage_cal/exception.py

51 lines
1.1 KiB
Python
Raw Normal View History

2023-12-27 05:43:17 +00:00
from typing import Union
2023-10-30 06:31:15 +00:00
class UidNotfoundError(Exception):
def __init__(self, uid: str):
self.uid = uid
def __str__(self):
2023-12-27 05:43:17 +00:00
return self.uid
2023-10-30 06:31:15 +00:00
class CharNameError(Exception):
def __init__(self, char_name: str):
self.char_name = char_name
def __str__(self):
2023-12-27 05:43:17 +00:00
return self.char_name
class MihomoModelError(Exception):
def __init__(self, exce: Union[Exception, str]):
self.exce = exce.args[0] if isinstance(exce, Exception) else exce
def __str__(self):
return self.exce
class MihomoQueueTimeoutError(Exception):
def __str__(self):
return "Mihomo queue timeout, please try again later."
2023-10-30 06:31:15 +00:00
class MihomoRequestError(Exception):
2023-12-27 05:43:17 +00:00
def __init__(self, exce: Union[Exception, str]):
self.exce = exce.args[0] if isinstance(exce, Exception) else exce
def __str__(self):
return self.exce
2023-10-30 06:31:15 +00:00
class NotInCharacterShowcaseError(Exception):
pass
class CharacterShowcaseNotOpenError(Exception):
def __init__(self, uid: str):
self.uid = uid
def __str__(self):
2023-12-27 05:43:17 +00:00
return self.uid