Open anselor opened 2 years ago
Warnings/errors with generic messages do not provide context for what in the code caused the error.
Specifically, I ran into it here:
https://github.com/tox-dev/sphinx-autodoc-typehints/blob/bf27befb610426838d1f2926e470815c47cc8ab8/src/sphinx_autodoc_typehints/__init__.py#L343
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:
guarded_code
https://github.com/tox-dev/sphinx-autodoc-typehints/blob/bf27befb610426838d1f2926e470815c47cc8ab8/src/sphinx_autodoc_typehints/__init__.py#L347
when logging inside an except handler, it's often useful to include exc_info=True.
exc_info=True
Warnings/errors with generic messages do not provide context for what in the code caused the error.
Specifically, I ran into it here:
https://github.com/tox-dev/sphinx-autodoc-typehints/blob/bf27befb610426838d1f2926e470815c47cc8ab8/src/sphinx_autodoc_typehints/__init__.py#L343
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:https://github.com/tox-dev/sphinx-autodoc-typehints/blob/bf27befb610426838d1f2926e470815c47cc8ab8/src/sphinx_autodoc_typehints/__init__.py#L347