-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
oauth/services: don't abuse log.exception #4133
Conversation
log.exception should not be used outside exception handlers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
I'm not sure I follow this change, though. When an unhandled exception happen, we want to log it with the whole traceback which is useful for debugging.
Those log.exceptions
belongs to the clause try/except/else
which are valid.
Why do you think it's better to log.error
instead of log.exception
here?
Because else is not for unhandled exceptions but for code that does not raise any exception:
|
Yeah, I got confused. Sorry about that. So, we probably want to refactor that code since if the |
Because of |
I understand. I'd say that code needs to be rewritten with an easy to follow and clear flow, then :) |
If you have time I'd do some audit of try-else usage in RTD, the next PR is fixing another misusage :) |
Thanks! |
log.exception should not be used outside exception handlers