mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-15 22:19:18 +00:00
Opt: Show failed route at last
This commit is contained in:
parent
ff48ba74dd
commit
5efb2a8cb4
@ -71,7 +71,11 @@ class RouteLoader(UI):
|
||||
before_func_obj = self.route_obj.__getattribute__('before_route')
|
||||
except AttributeError:
|
||||
before_func_obj = empty_function
|
||||
before_func_obj()
|
||||
try:
|
||||
before_func_obj()
|
||||
except (GameStuckError, GameTooManyClickError):
|
||||
logger.error(f'Route failed: {route}')
|
||||
raise
|
||||
|
||||
# Run route
|
||||
try:
|
||||
@ -80,16 +84,21 @@ class RouteLoader(UI):
|
||||
logger.critical(e)
|
||||
logger.critical(f'Route class in {route} ({path}) does not have method {func}')
|
||||
raise ScriptError
|
||||
self.route_func = func
|
||||
self.route_obj.route_func = func
|
||||
try:
|
||||
func_obj()
|
||||
except (GameStuckError, GameTooManyClickError):
|
||||
logger.error(f'Route failed: {route}')
|
||||
raise
|
||||
self.route_func = func
|
||||
self.route_obj.route_func = func
|
||||
func_obj()
|
||||
|
||||
# after_route()
|
||||
try:
|
||||
after_route_obj = self.route_obj.__getattribute__('after_route')
|
||||
except AttributeError:
|
||||
after_route_obj = empty_function
|
||||
after_route_obj()
|
||||
try:
|
||||
after_route_obj()
|
||||
except (GameStuckError, GameTooManyClickError):
|
||||
logger.error(f'Route failed: {route}')
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user