Skip to content

Capture specific exception types in except #40

@JPTIZ

Description

@JPTIZ

Some exception handling code take the generic type Exception in except and, in a couple cases:

if isinstance(exc, telegram.error.BadRequest):

if isinstance(exc, telegram.error.BadRequest):

if isinstance(exc, telegram.error.BadRequest):

And, after #34 is merged:

if isinstance(exc, VideoTooLongError):

So instead of doing:

except Exception as exc:
    if isinstance(exc, SpecificType):

We should slightly rework the code to get exceptions as:

except SpecificType as error:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions