Skip to content

Commit

Permalink
Display exception message on deploy command failure
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonbiemond committed Jan 12, 2025
1 parent c7c3370 commit 54ee623
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions dlt/cli/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:"
)
Expand Down

0 comments on commit 54ee623

Please sign in to comment.