diff --git a/module/exception.py b/module/exception.py index cd35216489..d0a7b85b8e 100644 --- a/module/exception.py +++ b/module/exception.py @@ -1,59 +1,100 @@ -class CampaignEnd(Exception): +# ALASBaseException +# ├── ScriptError +# ├── ScriptEnd +# ├── EmulatorNotRunningError +# ├── RequestHumanTakeover +# ├── CampaignBaseException +# │ ├── CampaignEnd +# │ └── CampaignNameError +# ├── MapBaseException +# │ ├── MapDetectionError +# │ ├── MapWalkError +# │ └── MapEnemyMoved +# └── GameBaseException +# ├── GameStuckError +# ├── GameBugError +# ├── GameTooManyClickError +# ├── GameNotRunningError +# └── GamePageUnknownError + + +class ALASBaseException(Exception): pass -class MapDetectionError(Exception): +class ScriptError(ALASBaseException): + # This is likely to be a mistake of developers, but sometimes a random issue pass -class MapWalkError(Exception): +class ScriptEnd(ALASBaseException): pass -class MapEnemyMoved(Exception): +class EmulatorNotRunningError(ALASBaseException): pass -class CampaignNameError(Exception): +class RequestHumanTakeover(ALASBaseException): + # Request human takeover + # Alas is unable to handle such error, probably because of wrong settings. + def __init__(self, message='Request human takeover', *args): + super().__init__(message, *args) + + +# Campaign +class CampaignBaseException(ALASBaseException): pass -class ScriptError(Exception): - # This is likely to be a mistake of developers, but sometimes a random issue +class CampaignEnd(CampaignBaseException): pass -class ScriptEnd(Exception): +class CampaignNameError(CampaignBaseException): pass -class GameStuckError(Exception): +# Map +class MapBaseException(ALASBaseException): pass -class GameBugError(Exception): - # An error has occurred in Azur Lane game client. Alas is unable to handle. - # A restart should fix it. +class MapDetectionError(MapBaseException): pass -class GameTooManyClickError(Exception): +class MapWalkError(MapBaseException): pass -class EmulatorNotRunningError(Exception): +class MapEnemyMoved(MapBaseException): pass -class GameNotRunningError(Exception): +# Game +class GameBaseException(ALASBaseException): pass -class GamePageUnknownError(Exception): +class GameStuckError(GameBaseException): pass -class RequestHumanTakeover(Exception): - # Request human takeover - # Alas is unable to handle such error, probably because of wrong settings. +class GameBugError(GameBaseException): + # An error has occurred in Azur Lane game client. Alas is unable to handle. + # A restart should fix it. + pass + + +class GameTooManyClickError(GameBaseException): pass + + +class GameNotRunningError(GameBaseException): + pass + + +class GamePageUnknownError(GameBaseException): + def __init__(self, message='Game page unknown', *args): + super().__init__(message, *args)