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

Every warning/error should provide useful context #238

Open
anselor opened this issue Jun 17, 2022 · 1 comment
Open

Every warning/error should provide useful context #238

anselor opened this issue Jun 17, 2022 · 1 comment

Comments

@anselor
Copy link

anselor commented Jun 17, 2022

Warnings/errors with generic messages do not provide context for what in the code caused the error.

Specifically, I ran into it here:

_LOGGER.warning(f"Failed guarded type import with {exc!r}")

I changed that log to also print guarded_code and it helped a lot. But I really think it should reraise the exception with the guarded_code and then catch and log it here with additional context:

_resolve_type_guarded_imports(autodoc_mock_imports, obj)

@ewjoachim
Copy link

ewjoachim commented Sep 27, 2022

when logging inside an except handler, it's often useful to include exc_info=True.

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

No branches or pull requests

3 participants