mirror of
https://github.com/TheFunny/ArisuAutoSweeper
synced 2026-10-14 02:02:16 +00:00
feat: add error postprocessing method and invoke on exceptions
This commit is contained in:
@@ -124,6 +124,7 @@ class AzurLaneAutoScript:
|
|||||||
return False
|
return False
|
||||||
except ScriptError as e:
|
except ScriptError as e:
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
|
self.error_postprocess()
|
||||||
logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
|
logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
|
||||||
self.save_error_log()
|
self.save_error_log()
|
||||||
handle_notify(
|
handle_notify(
|
||||||
@@ -134,6 +135,7 @@ class AzurLaneAutoScript:
|
|||||||
exit(1)
|
exit(1)
|
||||||
except RequestHumanTakeover:
|
except RequestHumanTakeover:
|
||||||
logger.critical('Request human takeover')
|
logger.critical('Request human takeover')
|
||||||
|
self.error_postprocess()
|
||||||
handle_notify(
|
handle_notify(
|
||||||
self.config.Error_OnePushConfig,
|
self.config.Error_OnePushConfig,
|
||||||
title=f"AAS <{self.config_name}> crashed",
|
title=f"AAS <{self.config_name}> crashed",
|
||||||
@@ -142,6 +144,7 @@ class AzurLaneAutoScript:
|
|||||||
exit(1)
|
exit(1)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception(e)
|
logger.exception(e)
|
||||||
|
self.error_postprocess()
|
||||||
self.save_error_log()
|
self.save_error_log()
|
||||||
handle_notify(
|
handle_notify(
|
||||||
self.config.Error_OnePushConfig,
|
self.config.Error_OnePushConfig,
|
||||||
@@ -157,6 +160,12 @@ class AzurLaneAutoScript:
|
|||||||
"""
|
"""
|
||||||
save_error_log(config=self.config, device=self.device)
|
save_error_log(config=self.config, device=self.device)
|
||||||
|
|
||||||
|
def error_postprocess(self):
|
||||||
|
"""
|
||||||
|
Do something when error occurred
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def wait_until(self, future):
|
def wait_until(self, future):
|
||||||
"""
|
"""
|
||||||
Wait until a specific time.
|
Wait until a specific time.
|
||||||
|
|||||||
Reference in New Issue
Block a user