Skip to content

Refactor handling of exceptions raised by error handlers #2601

@Bibo-Joshi

Description

@Bibo-Joshi

Currently, we do something like

try:
    dispatcher.dispatch_error(exception)
except:
    logger.execption(…)

everywhere, where we call dispatcher.dispatch_error, leading to some code repetition. I propose to instead move that logic directly into Dispatcher.dispatch_error. The only downside of this would be that currently log message in line 4 above can contain some explicit hint on where the exception happened, but one can also just read the traceback …

Edit: This would also cover cases where some CustomContext.from_* raises an exception, see the discussion at https://t.me/c/1494805131/17428

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions