Skip to content

Commit

Permalink
Add try/except around event handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mnordseth committed Jun 18, 2024
1 parent 6776a10 commit ac8573c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion custom_components/enet/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ async def _async_update_data(self):
while True:
event = await self.hub.get_events()
if event:
self.handle_event(event)
try:
self.handle_event(event)
except Exception as e:
log.exception("Failed to handle event: %s", event)


def handle_event(self, event_data):
"""Handle events from Enet Server. Either update value of actuator or
Expand Down

0 comments on commit ac8573c

Please sign in to comment.