Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
raqbit opened this issue Jul 23, 2024 · 0 comments

Comments

@raqbit
Copy link

raqbit commented Jul 23, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant