1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

suppress tracebacks in ErrorHandler recovery (#8310)

The ErrorHandler context manager could produce very verbose CLI output
when handling long exception chains (PIP 3134 enhanced reporting).

Rather than logging every exception with its traceback to the CLI, this
commit changes ErrorHandler so that only the final exception in the
chain, without traceback, is logged to the CLI.

This is consistent with a previous change made in the global except
hook (#8000).
This commit is contained in:
alexzorin
2020-09-25 07:22:38 +10:00
committed by GitHub
parent 9a72db5b9b
commit 5ec29ca60b
2 changed files with 5 additions and 2 deletions

View File

@@ -14,6 +14,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
* Update the packaging instructions to promote usage of `python -m pytest` to test Certbot
instead of the deprecated `python setup.py test` setuptools approach.
* Reduced CLI logging when reloading nginx, if it is not running.
* Reduced CLI logging when handling some kinds of errors.
### Fixed

View File

@@ -123,8 +123,10 @@ class ErrorHandler(object):
while self.funcs:
try:
self.funcs[-1]()
except Exception: # pylint: disable=broad-except
logger.error("Encountered exception during recovery: ", exc_info=True)
except Exception as exc: # pylint: disable=broad-except
output = traceback.format_exception_only(type(exc), exc)
logger.error("Encountered exception during recovery: %s",
''.join(output).rstrip())
self.funcs.pop()
def _set_signal_handlers(self):