diff --git a/dvc/commands/get.py b/dvc/commands/get.py index 0098326716..17da0d5e5f 100644 --- a/dvc/commands/get.py +++ b/dvc/commands/get.py @@ -4,6 +4,7 @@ from dvc.cli import completion from dvc.cli.command import CmdBaseNoRepo from dvc.exceptions import DvcException +from dvc.scm import CloneError from ..cli.utils import append_doc_link @@ -44,6 +45,9 @@ def _get_file_from_repo(self): jobs=self.args.jobs, ) return 0 + except CloneError: + logger.exception(f"failed to get '{self.args.path}'") + return 1 except DvcException: logger.exception( "failed to get '{}' from '{}'".format( diff --git a/dvc/commands/imp.py b/dvc/commands/imp.py index f11b5bb834..c6a6d9122a 100644 --- a/dvc/commands/imp.py +++ b/dvc/commands/imp.py @@ -5,6 +5,7 @@ from dvc.cli.command import CmdBase from dvc.cli.utils import append_doc_link from dvc.exceptions import DvcException +from dvc.scm import CloneError logger = logging.getLogger(__name__) @@ -26,6 +27,9 @@ def run(self): meta=self.args.meta, jobs=self.args.jobs, ) + except CloneError: + logger.exception(f"failed to import '{self.args.path}'") + return 1 except DvcException: logger.exception( "failed to import '{}' from '{}'.".format( diff --git a/dvc/scm.py b/dvc/scm.py index b64413e9e3..c61efa9078 100644 --- a/dvc/scm.py +++ b/dvc/scm.py @@ -147,7 +147,7 @@ def clone(url: str, to_path: str, **kwargs): fetch_all_exps(git, url, progress=pbar.update_git) return git except InternalCloneError as exc: - raise CloneError(str(exc)) + raise CloneError("SCM error") from exc def resolve_rev(scm: "Git", rev: str) -> str: