mirror of
https://github.com/0O0o0oOoO00/Alas.git
synced 2026-05-14 09:09:26 +08:00
upd: shrink CrackerError message
This commit is contained in:
19
alas.py
19
alas.py
@@ -593,6 +593,7 @@ from module.counter import MaxCounter
|
||||
from typing import Dict
|
||||
from module.device.my_assets import my_OTHERS_LOGIN_CONFIRM
|
||||
from module.config.utils import filepath_i18n, read_file
|
||||
from module.luahook.exception import CrackerError
|
||||
|
||||
|
||||
class FailedTaskCounter:
|
||||
@@ -783,6 +784,22 @@ class AzurLaneAutoScript(AzurLaneAutoScript):
|
||||
if i.next_run < target:
|
||||
self.config.task_delay(target=target, task=i.command)
|
||||
|
||||
def handle_CrackerError(self, e) -> bool:
|
||||
logger.critical(e)
|
||||
self.save_error_log()
|
||||
if self.is_fatal_error_restart:
|
||||
logger.info("Fatal error occured, call restart")
|
||||
self.config.task_call('Restart')
|
||||
self.device.sleep(10)
|
||||
return False
|
||||
else:
|
||||
handle_notify(
|
||||
self.config.Error_OnePushConfig,
|
||||
title=f"Alas <{self.config_name}> crashed",
|
||||
content=f"<{self.config_name}> Exception occured",
|
||||
)
|
||||
exit(1)
|
||||
|
||||
def handle_OthersLogin(self, e) -> bool:
|
||||
logger.warning("Detected others' login")
|
||||
self.delay_all_tasks()
|
||||
@@ -829,6 +846,8 @@ class AzurLaneAutoScript(AzurLaneAutoScript):
|
||||
return self.handle_RequestHumanTakeover(e)
|
||||
except OthersLogin as e:
|
||||
return self.handle_OthersLogin(e)
|
||||
except CrackerError as e:
|
||||
return self.handle_CrackerError(e)
|
||||
except Exception as e:
|
||||
return self.handle_Exception(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user