Skip to content

Commit bcc7d56

Browse files
authored
Pass handler to exception handling methods
1 parent bf81d54 commit bcc7d56

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

pyrogram/dispatcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ async def handler_worker(self, lock):
414414
continue
415415
except Exception as exc:
416416
await self.handle_update_handler_exception(
417-
exc, update, users, chats
417+
exc, handler, update, users, chats
418418
)
419419

420420
break
@@ -426,6 +426,7 @@ async def handler_worker(self, lock):
426426
async def handle_update_handler_exception(
427427
self,
428428
exc: Exception,
429+
update_handler: Handler,
429430
update: pyrogram.raw.base.Update,
430431
users: dict[int, pyrogram.raw.base.User],
431432
chats: dict[int, pyrogram.raw.base.Chat]
@@ -440,12 +441,12 @@ async def handle_update_handler_exception(
440441
try:
441442
if inspect.iscoroutinefunction(handler.callback):
442443
await handler.callback(
443-
self.client, exc, update, users, chats
444+
self.client, exc, update_handler, update, users, chats
444445
)
445446
else:
446447
await self.client.loop.run_in_executor(
447448
self.client.executor, handler.callback,
448-
self.client, exc, update, users, chats
449+
self.client, exc, update_handler, update, users, chats
449450
)
450451
except pyrogram.StopPropagation:
451452
handled = True
@@ -466,5 +467,4 @@ async def handle_update_handler_exception(
466467
log.error(
467468
f"Unexpected exception raised in {type(update_handler).__name__}:",
468469
exc_info=(type(exc), exc, exc.__traceback__)
469-
)
470-
470+
)

0 commit comments

Comments
 (0)