Add extensions for class-based error handler

This commit is contained in:
Alex Root Junior 2020-04-12 23:29:10 +03:00
parent 0fbd2819f9
commit 01c6303d67
3 changed files with 43 additions and 3 deletions

View file

@ -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