Skip to content

Commit

Permalink
catch exception when _run_watchers (#898)
Browse files Browse the repository at this point in the history
* catch exception when _run_watchers

* update setup.cfg

---------

Co-authored-by: yangyang <yangyangjishu@bluecity.com>
  • Loading branch information
twoyang0917 and yangyang authored Mar 20, 2024
1 parent cb8e16d commit 9351f0f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[metadata]
name = uiautomator2
author = codeskyblue
author-email = codeskyblue@gmail.com
author_email = codeskyblue@gmail.com
summary = Python Wrapper for Google Android UiAutomator2 test tool
license = MIT
description-file = ABOUT.rst
home-page = https://github.com/openatx/uiautomator2
description_file = ABOUT.rst
home_page = https://github.com/openatx/uiautomator2
# all classifier can be found in https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifier =
Development Status :: 4 - Beta
Expand All @@ -32,5 +32,5 @@ image =

[entry_points]
# https://docs.openstack.org/pbr/3.1.1/#entry-points
console_scripts =
console_scripts =
uiautomator2 = uiautomator2.__main__:main
8 changes: 6 additions & 2 deletions uiautomator2/watcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def wait_stable(self, seconds: float = 5.0, timeout: float = 60.0):
Args:
seconds: stable seconds
timeout: raise error when wait stable timeout
Raises:
TimeoutError
"""
Expand Down Expand Up @@ -236,7 +236,11 @@ def run(self, source: Optional[str] = None):
"""
if self.triggering: # avoid to run watcher when run watcher
return False
return self._run_watchers(source=source)
try:
return self._run_watchers(source=source)
except Exception as e:
self.logger.warning("_run_watchers exception: %s", e)
return False

def _run_watchers(self, source=None) -> bool:
"""
Expand Down

0 comments on commit 9351f0f

Please sign in to comment.