File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -267,11 +267,20 @@ async def handle_transaction(
267267 except SerializerError :
268268 self .log .exception ("Failed to deserialize to-device event %s" , raw_td )
269269 else :
270- await self .to_device_handler (td )
270+ try :
271+ await self .to_device_handler (td )
272+ except :
273+ self .log .exception ("Exception in Matrix to-device event handler" )
271274 if device_lists and self .device_list_handler :
272- await self .device_list_handler (device_lists )
275+ try :
276+ await self .device_list_handler (device_lists )
277+ except Exception :
278+ self .log .exception ("Exception in Matrix device list change handler" )
273279 if otk_counts and self .otk_handler :
274- await self .otk_handler (otk_counts )
280+ try :
281+ await self .otk_handler (otk_counts )
282+ except Exception :
283+ self .log .exception ("Exception in Matrix OTK count handler" )
275284 for raw_edu in ephemeral or []:
276285 try :
277286 edu = EphemeralEvent .deserialize (raw_edu )
@@ -304,6 +313,7 @@ async def try_handle(handler_func: HandlerFunc):
304313 self .log .exception ("Exception in Matrix event handler" )
305314
306315 for handler in self .event_handlers :
316+ # TODO add option to handle events synchronously
307317 asyncio .create_task (try_handle (handler ))
308318
309319 def matrix_event_handler (self , func : HandlerFunc ) -> HandlerFunc :
You can’t perform that action at this time.
0 commit comments