From 40501b596d63ad0528a3c7bc7e3a2f68c3e4f87d Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 9 Mar 2020 14:14:21 +0100 Subject: [PATCH] Better error handling in lib/cr_tf/handler.py --- lib/cr_tf/handler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/cr_tf/handler.py b/lib/cr_tf/handler.py index 7c31a7d..20a44c3 100644 --- a/lib/cr_tf/handler.py +++ b/lib/cr_tf/handler.py @@ -60,7 +60,7 @@ from .terraform.disk import TerraformDisk from .xlate import XLATOR -__version__ = '3.4.3' +__version__ = '3.4.4' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -377,8 +377,9 @@ class CreateTerraformHandler(BaseHandler): try: api_version = self.pdns.get_api_server_version() # noqa - except PowerDNSHandlerError as e: - raise ExpectedHandlerError(str(e)) + except (PowerDNSHandlerError, ConnectionError) as e: + msg = "{c}: {e}".format(c=e.__class__.__name__, e=str(e)) + raise ExpectedHandlerError(msg) # ------------------------------------------------------------------------- def check_terraform_version(self): -- 2.39.5