Skip to content

Exception log method used outside exception handler for unexpected connection close #200

@raqbit

Description

@raqbit

When a connection is unexpectedly closed, aiormq logs this with the log.exception function (link), breaking parts of the structlog logging library.

The structlog ExceptionDictTransformer exception transformer expects this function to only get called from an exception handler. When called outside an exception handler, it raises an exception itself when it is passed the results of sys.exc_info() ((None, None, None)), as it tries to access __name__ of the exc_type.

While I think it is a bug in the structlog library that this leads to an exception during logging (issue) I think it would be nice to change the log.exception into log.error to avoid triggering this bug or potentially other bugs in log formatters that expect exception to only be used while handling an exception.

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