sphinx-autodoc-typehints icon indicating copy to clipboard operation
sphinx-autodoc-typehints copied to clipboard

Every warning/error should provide useful context

Open anselor opened this issue 3 years ago • 1 comments

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

anselor avatar Jun 17 '22 20:06 anselor

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

ewjoachim avatar Sep 27 '22 12:09 ewjoachim