Skip to content

Commit

Permalink
Consider DeliveryError not fatal unless requested
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Oct 31, 2023
1 parent a3e89eb commit 64c483f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions custom_components/zha_toolkit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from homeassistant.components.zha.core.gateway import ZHAGateway
from homeassistant.util import dt as dt_util
from zigpy import types as t
from zigpy.exceptions import DeliveryError

from . import params as PARDEFS
from . import utils as u
Expand Down Expand Up @@ -815,10 +816,13 @@ async def toolkit_service(service):
if handler_exception is not None:
LOGGER.error(
"Exception '%s' for service call with data '%r'",
params[p.EVT_DONE],
handler_exception,
event_data,
)
raise handler_exception
if params[p.FAIL_EXCEPTION] or not isinstance(
handler_exception, DeliveryError
):
raise handler_exception

if not event_data["success"] and params[p.FAIL_EXCEPTION]:
raise Exception("Success expected, but failed")
Expand Down

0 comments on commit 64c483f

Please sign in to comment.