1
0
mirror of https://gitee.com/sui-feng-cb/AzurLaneAutoScript1 synced 2026-03-12 05:08:19 +08:00

Refactor: More accurate exceptions and add friendly advices

This commit is contained in:
LmeSzinc
2021-09-16 12:09:00 +08:00
parent 5dd0459de9
commit 61cbe75527
22 changed files with 474 additions and 142 deletions

View File

@@ -1,5 +1,7 @@
from module.device.connection import Connection
from module.logger import logger
from uiautomator2.exceptions import BaseError
from module.exception import RequestHumanTakeover
class AppControl(Connection):
@@ -12,8 +14,16 @@ class AppControl(Connection):
def app_stop(self):
logger.info(f'App stop: {self.config.Emulator_PackageName}')
self.device.app_stop(self.config.Emulator_PackageName)
try:
self.device.app_stop(self.config.Emulator_PackageName)
except BaseError as e:
logger.critical(e)
raise RequestHumanTakeover
def app_start(self):
logger.info(f'App start: {self.config.Emulator_PackageName}')
self.device.app_start(self.config.Emulator_PackageName)
try:
self.device.app_start(self.config.Emulator_PackageName)
except BaseError as e:
logger.critical(e)
raise RequestHumanTakeover