Improve handling of exceptions in Android TV (#39229)
* Close the ADB connection when there is an exception
* Add a test
* Split a comment onto two lines
* Fix test ('async_update' -> 'async_update_entity')
* 'close' -> 'Close'
This commit is contained in:
1 parent
904f5c4346
commit
ad0d3b4848
3 files changed
+57
-11
No files matched your search
@@ -376,6 +376,12 @@ def adb_decorator(override_available=False):
|
||||
await self.aftv.adb_close()
|
||||
self._available = False
|
||||
return None
|
||||
except Exception:
|
||||
# An unforeseen exception occurred. Close the ADB connection so that
|
||||
# it doesn't happen over and over again, then raise the exception.
|
||||
await self.aftv.adb_close()
|
||||
self._available = False # pylint: disable=protected-access
|
||||
raise
|
||||
|
||||
return _adb_exception_catcher
|
||||
|
||||
@@ -421,10 +427,8 @@ class ADBDevice(MediaPlayerEntity):
|
||||
# Using "adb_shell" (Python ADB implementation)
|
||||
self.exceptions = (
|
||||
AdbTimeoutError,
|
||||
AttributeError,
|
||||
BrokenPipeError,
|
||||
ConnectionResetError,
|
||||
TypeError,
|
||||
ValueError,
|
||||
InvalidChecksumError,
|
||||
InvalidCommandError,
|
||||
|
||||
Reference in new issue
Block a user