mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Catch kodi protocol errors (#67555)
This commit is contained in:
parent
ea2c3e3310
commit
a9ebeb2876
@ -278,14 +278,20 @@ def cmd(func):
|
||||
"""Wrap all command methods."""
|
||||
try:
|
||||
await func(obj, *args, **kwargs)
|
||||
except jsonrpc_base.jsonrpc.TransportError as exc:
|
||||
except (
|
||||
jsonrpc_base.jsonrpc.TransportError,
|
||||
jsonrpc_base.jsonrpc.ProtocolError,
|
||||
) as exc:
|
||||
# If Kodi is off, we expect calls to fail.
|
||||
if obj.state == STATE_OFF:
|
||||
log_function = _LOGGER.info
|
||||
log_function = _LOGGER.debug
|
||||
else:
|
||||
log_function = _LOGGER.error
|
||||
log_function(
|
||||
"Error calling %s on entity %s: %r", func.__name__, obj.entity_id, exc
|
||||
"Error calling %s on entity %s: %r",
|
||||
func.__name__,
|
||||
obj.entity_id,
|
||||
exc,
|
||||
)
|
||||
|
||||
return wrapper
|
||||
|
Loading…
x
Reference in New Issue
Block a user