-
-
Notifications
You must be signed in to change notification settings - Fork 225
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
ExceptionRenderer w/ ExceptionDictTransformer unable to handle exception log outside exception handler #634
Comments
Is this a new issue? @sscherfke I'm afraid there's work for you. 🤓 |
Can reproduce in 24.2.0, which does not include #627
|
I don't think I introduced this in the last release and I think that @raqbit is right in admitting that is was wrong to call |
Perhaps this should be handled in |
The typing of
|
The |
When using the
exception
log method outside an exception handler, theExceptionDictTransformer
raises anAttributeError
as it callsextract
, which does not handle the case where the given exception type isNone
.While according to the Python docs1 this method should only be used from exception handlers, I ran into this issue as the aio-pika (aiormq) library uses it outside an exception handler (issue). (I have configured structlog as the formatter for all loggers, using this setup)
Note that the default
_format_exception
formatter handles this case properly, as it handles(None, None, None)
exc_info2.Reproduction:
Footnotes
https://docs.python.org/3/library/logging.html#logging.Logger.exception ↩
https://github.com/hynek/structlog/blob/e48a553979b00ab580d8ab0e55b5cf96e752a324/src/structlog/_frames.py#L25 ↩
The text was updated successfully, but these errors were encountered: