mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 13:47:35 +00:00
Improved exception handling and logging (#22268)
Catch RuntimeError exceptions. Don't log ADB command output if there isn't any.
This commit is contained in:
parent
c90e13bfef
commit
b125514655
@ -163,7 +163,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
output = target_device.adb_command(cmd)
|
||||
|
||||
# log the output if there is any
|
||||
if output:
|
||||
if output and (not isinstance(output, str) or output.strip()):
|
||||
_LOGGER.info("Output of command '%s' from '%s': %s",
|
||||
cmd, target_device.entity_id, repr(output))
|
||||
|
||||
@ -223,7 +223,7 @@ class ADBDevice(MediaPlayerDevice):
|
||||
TcpTimeoutException)
|
||||
else:
|
||||
# Using "pure-python-adb" (communicate with ADB server)
|
||||
self.exceptions = (ConnectionResetError,)
|
||||
self.exceptions = (ConnectionResetError, RuntimeError)
|
||||
|
||||
# Property attributes
|
||||
self._available = self.aftv.available
|
||||
|
Loading…
x
Reference in New Issue
Block a user