feat: add error postprocessing method and invoke on exceptions

This commit is contained in:
2026-07-06 22:40:42 +08:00
parent 892fabe501
commit d83ce3bdc3
+9
View File
@@ -124,6 +124,7 @@ class AzurLaneAutoScript:
return False
except ScriptError as e:
logger.exception(e)
self.error_postprocess()
logger.critical('This is likely to be a mistake of developers, but sometimes just random issues')
self.save_error_log()
handle_notify(
@@ -134,6 +135,7 @@ class AzurLaneAutoScript:
exit(1)
except RequestHumanTakeover:
logger.critical('Request human takeover')
self.error_postprocess()
handle_notify(
self.config.Error_OnePushConfig,
title=f"AAS <{self.config_name}> crashed",
@@ -142,6 +144,7 @@ class AzurLaneAutoScript:
exit(1)
except Exception as e:
logger.exception(e)
self.error_postprocess()
self.save_error_log()
handle_notify(
self.config.Error_OnePushConfig,
@@ -157,6 +160,12 @@ class AzurLaneAutoScript:
"""
save_error_log(config=self.config, device=self.device)
def error_postprocess(self):
"""
Do something when error occurred
"""
pass
def wait_until(self, future):
"""
Wait until a specific time.