From 31aed9b27b8b14243ce2e8b3d33c3d7ab865e964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Redzy=C5=84ski?= Date: Tue, 26 Nov 2019 14:33:48 +0100 Subject: [PATCH] NoRemoteInExternalRepoError: dont pass cause of exception --- dvc/exceptions.py | 9 ++++----- dvc/external_repo.py | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dvc/exceptions.py b/dvc/exceptions.py index 92f46a8829..1a167117ad 100644 --- a/dvc/exceptions.py +++ b/dvc/exceptions.py @@ -332,13 +332,12 @@ class CollectCacheError(DvcException): pass -class RemoteNotSpecifiedInExternalRepoError(DvcException): - def __init__(self, url, cause=None): - super(RemoteNotSpecifiedInExternalRepoError, self).__init__( +class NoRemoteInExternalRepoError(DvcException): + def __init__(self, url): + super(NoRemoteInExternalRepoError, self).__init__( "No DVC remote is specified in the target repository '{}'".format( url - ), - cause=cause, + ) ) diff --git a/dvc/external_repo.py b/dvc/external_repo.py index 0555f2d756..9d90963009 100644 --- a/dvc/external_repo.py +++ b/dvc/external_repo.py @@ -8,7 +8,7 @@ from funcy import retry from dvc.config import NoRemoteError -from dvc.exceptions import RemoteNotSpecifiedInExternalRepoError +from dvc.exceptions import NoRemoteInExternalRepoError from dvc.exceptions import NoOutputInExternalRepoError from dvc.exceptions import OutputNotFoundError from dvc.utils.fs import remove @@ -25,8 +25,8 @@ def external_repo(url=None, rev=None, rev_lock=None, cache_dir=None): repo = Repo(path) try: yield repo - except NoRemoteError as exc: - raise RemoteNotSpecifiedInExternalRepoError(url, cause=exc) + except NoRemoteError: + raise NoRemoteInExternalRepoError(url) except OutputNotFoundError as exc: if exc.repo is repo: raise NoOutputInExternalRepoError(exc.output, repo.root_dir, url)