From 54ee62399ab9bf6067c02d62f445e21d78b2bee3 Mon Sep 17 00:00:00 2001 From: Jonathan Biemond Date: Sun, 12 Jan 2025 12:09:52 +0100 Subject: [PATCH] Display exception message on deploy command failure Include the exception message when the deploy command fails due to a missing import. This way the user has the necessary information to resolve the error. --- dlt/cli/plugins.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dlt/cli/plugins.py b/dlt/cli/plugins.py index 1712efbbd7..e120d102a8 100644 --- a/dlt/cli/plugins.py +++ b/dlt/cli/plugins.py @@ -32,9 +32,9 @@ SecretFormats, ) - deploy_command_available = True -except ModuleNotFoundError: - deploy_command_available = False + deploy_command_import_exception = None +except ModuleNotFoundError as exc: + deploy_command_import_exception = exc @plugins.hookspec() @@ -316,7 +316,7 @@ def configure_parser(self, parser: argparse.ArgumentParser) -> None: "pipeline_script_path", metavar="pipeline-script-path", help="Path to a pipeline script" ) - if not deploy_command_available: + if deploy_command_import_exception: return deploy_comm.add_argument( @@ -375,7 +375,8 @@ def configure_parser(self, parser: argparse.ArgumentParser) -> None: def execute(self, args: argparse.Namespace) -> None: # exit if deploy command is not available - if not deploy_command_available: + if deploy_command_import_exception: + fmt.error(str(deploy_command_import_exception)) fmt.warning( "Please install additional command line dependencies to use deploy command:" )