mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-11 20:58:19 +08:00
Refactor: module/device, separate all screenshot method and control methods
- Better screenshot and control retries, handle common exceptions
This commit is contained in:
@@ -76,6 +76,16 @@ def attr_align(name, text, front='', align=22):
|
||||
logger.info('%s: %s' % (name, str(text)))
|
||||
|
||||
|
||||
def error_convert(func):
|
||||
def error_wrapper(msg, *args, **kwargs):
|
||||
if isinstance(msg, Exception):
|
||||
msg = f'{type(msg).__name__}: {msg}'
|
||||
return func(msg, *args, **kwargs)
|
||||
|
||||
return error_wrapper
|
||||
|
||||
|
||||
logger.error = error_convert(logger.error)
|
||||
logger.hr = hr
|
||||
logger.attr = attr
|
||||
logger.attr_align = attr_align
|
||||
|
||||
Reference in New Issue
Block a user