mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
Add extensions for class-based error handler
This commit is contained in:
parent
0fbd2819f9
commit
01c6303d67
3 changed files with 43 additions and 3 deletions
|
|
@ -13,14 +13,17 @@ class MyHandler(ErrorHandler):
|
|||
async def handle(self) -> Any:
|
||||
log.exception(
|
||||
"Cause unexpected exception %s: %s",
|
||||
self.event.__class__.__name__,
|
||||
self.event
|
||||
self.exception_name,
|
||||
self.exception_message
|
||||
)
|
||||
```
|
||||
|
||||
## Extension
|
||||
|
||||
This base handler is subclass of [BaseHandler](basics.md#basehandler)
|
||||
This base handler is subclass of [BaseHandler](basics.md#basehandler) with some extensions:
|
||||
|
||||
- `#!python3 self.exception_name` is alias for `#!python3 self.event.__class__.__name__`
|
||||
- `#!python3 self.exception_message` is alias for `#!python3 str(self.event)`
|
||||
|
||||
## Related pages
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue