Skip to content

Minor nit: functions should accept BaseException instead of Exception type #35

@zplizzi

Description

@zplizzi

that way, you can do something like:

current_exception = sys.exception()
if current_exception is not None:
    tb = traceback_with_variables.format_exc(current_exception)

instead of currently needing to do

current_exception = sys.exception()
if current_exception is not None:
    tb = traceback_with_variables.format_exc(cast(current_exception, Exception))

and have the type checker be happy.

this makes sense more generally because there's no reason eg a KeyboardInterrupt shouldn't be handled with this library, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions