StarRailDamageCal/starrail_damage_cal/exception.py
2024-04-27 17:10:31 +08:00

59 lines
1.2 KiB
Python

from typing import Union
class UidNotfoundError(Exception):
def __init__(self, uid: str):
self.uid = uid
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):
self.char_name = char_name
def __str__(self):
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."
class MihomoRequestError(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 NotInCharacterShowcaseError(Exception):
pass
class CharacterShowcaseNotOpenError(Exception):
def __init__(self, uid: str):
self.uid = uid
def __str__(self):
return self.uid