From 8e9d867447ac16444810ce93b731eb8d395f2780 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9C=A8=20Q=20=28it/its=29=20=E2=9C=A8?= Date: Thu, 12 Jun 2025 00:15:45 +0200 Subject: [PATCH] Print error details when an IssuanceError is thrown (#9804) When a CA fails to issue a certificate after finalisation Certbot currently prints the following unhelpful message: ``` An unexpected error occurred: acme.errors.IssuanceError ``` This PR makes Certbot print the ACME error object from the order, as such ``` An unexpected error occurred: CAA error :: Invalid CAA: CAA prohibits issuance ``` ## Pull Request Checklist - [ ] The Certbot team has recently expressed interest in reviewing a PR for this. If not, this PR may be closed due our limited resources and need to prioritize how we spend them. - [x] If the change being made is to a [distributed component](https://certbot.eff.org/docs/contributing.html#code-components-and-layout), edit the `master` section of `certbot/CHANGELOG.md` to include a description of the change being made. - [x] Add or update any documentation as needed to support the changes in this PR. - [x] Include your name in `AUTHORS.md` if you like. --- certbot/CHANGELOG.md | 2 +- certbot/src/certbot/_internal/log.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/certbot/CHANGELOG.md b/certbot/CHANGELOG.md index 08002fbd9..8387bbd63 100644 --- a/certbot/CHANGELOG.md +++ b/certbot/CHANGELOG.md @@ -14,7 +14,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/). ### Fixed -* +* Fixed a bug where issuance error details where not printed More details about these changes can be found on our GitHub repo. diff --git a/certbot/src/certbot/_internal/log.py b/certbot/src/certbot/_internal/log.py index 3e38d656b..5a10c9fcb 100644 --- a/certbot/src/certbot/_internal/log.py +++ b/certbot/src/certbot/_internal/log.py @@ -373,8 +373,9 @@ def post_arg_parse_except_hook(exc_type: Type[BaseException], exc_value: BaseExc logger.error(str(exc_value)) exit_func() logger.error('An unexpected error occurred:') - if messages.is_acme_error(exc_value): - logger.error(display_util.describe_acme_error(cast(messages.Error, exc_value))) + acme_error = getattr(exc_value, "error", exc_value) + if messages.is_acme_error(acme_error): + logger.error(display_util.describe_acme_error(cast(messages.Error, acme_error))) else: output = traceback.format_exception_only(exc_type, exc_value) # format_exception_only returns a list of strings each