NoRemoteInExternalRepoError: dont pass cause of exception

This commit is contained in:
Paweł Redzyński
2019-11-27 10:05:16 +01:00
committed by pawel
parent f9d4ef8abd
commit 31aed9b27b
2 changed files with 7 additions and 8 deletions
+4 -5
View File
@@ -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,
)
)
+3 -3
View File
@@ -8,7 +8,7 @@ from distutils.dir_util import copy_tree
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)