diff --git a/dvc/command/add.py b/dvc/command/add.py index 911188772..2846b21d6 100644 --- a/dvc/command/add.py +++ b/dvc/command/add.py @@ -1,8 +1,13 @@ +from dvc.exceptions import DvcException from dvc.command.common.base import CmdBase class CmdAdd(CmdBase): def run(self): for target in self.args.targets: - self.project.add(target) + try: + self.project.add(target) + except DvcException as ex: + self.project.logger.error('Failed to add {}: {}'.format(target, str(ex))) + return 1 return 0 diff --git a/dvc/command/remove.py b/dvc/command/remove.py index 45dcce197..e2ea0d8fa 100644 --- a/dvc/command/remove.py +++ b/dvc/command/remove.py @@ -1,8 +1,13 @@ +from dvc.exceptions import DvcException from dvc.command.common.base import CmdBase class CmdRemove(CmdBase): def run(self): for target in self.args.targets: - self.project.remove(target) + try: + self.project.remove(target) + except DvcException as ex: + self.project.logger.error('Failed to remove {}: {}'.format(target, str(ex))) + return 1 return 0