From ae5f0f49b19b7cc8c97ee897e55ad3a358e2e5e6 Mon Sep 17 00:00:00 2001 From: "Maarten A. Breddels" Date: Wed, 25 May 2022 21:26:53 +0200 Subject: [PATCH] fix: .fire_event silently passes on exceptions --- ipyvue/VueWidget.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ipyvue/VueWidget.py b/ipyvue/VueWidget.py index c82547d..af3c8a3 100644 --- a/ipyvue/VueWidget.py +++ b/ipyvue/VueWidget.py @@ -96,8 +96,12 @@ def on_event(self, event_and_modifiers, callback, remove=False): if len(difference) != 0: self._events = list(self._event_handlers_map.keys()) - def fire_event(self, event, data): - self._event_handlers_map[event](self, event, data) + def fire_event(self, event, data=None): + """Manually trigger an event handler on the Python side.""" + dispatcher = self._event_handlers_map[event] + # we don't call via the dispatcher, since that eats exceptions + for callback in dispatcher.callbacks: + callback(self, event, data or {}) def _handle_event(self, _, content, buffers): event = content.get("event", "")