Skip to content

Commit

Permalink
Better errors handler
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterGroosha committed Mar 20, 2023
1 parent 6087266 commit ed3ebd8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions bot/handlers/errors.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
from aiogram import Router
from aiogram.exceptions import TelegramAPIError
from aiogram.types import Update
from aiogram.types.error_event import ErrorEvent

router = Router()


@router.errors()
async def errors_handler(update: Update, exception: TelegramAPIError):
async def errors_handler(event: ErrorEvent):
# Not very good, but for now it's okay
print(f"{str(exception)}. Update: {update.dict()}")
print(f"Error: {str(event.exception)}. Update: {event.update.dict()}")

0 comments on commit ed3ebd8

Please sign in to comment.