import: intercept and rephrase OutputNotFound message

This commit is contained in:
pawel
2019-11-19 14:42:18 +01:00
committed by Paweł Redzyński
parent 0ac18fb051
commit f575bc7a1d
2 changed files with 17 additions and 1 deletions
+9
View File
@@ -338,3 +338,12 @@ class RemoteNotSpecifiedInExternalRepoError(DvcException):
),
cause=cause,
)
class NoOutputInExternalRepoError(DvcException):
def __init__(self, repo_url, path):
super(NoOutputInExternalRepoError, self).__init__(
"Output '{}' not found in target repository: '{}'".format(
path, repo_url
)
)
+8 -1
View File
@@ -1,6 +1,13 @@
from dvc.exceptions import NoOutputInExternalRepoError
from dvc.exceptions import OutputNotFoundError
def imp(self, url, path, out=None, rev=None):
erepo = {"url": url}
if rev is not None:
erepo["rev"] = rev
return self.imp_url(path, out=out, erepo=erepo, locked=True)
try:
return self.imp_url(path, out=out, erepo=erepo, locked=True)
except OutputNotFoundError:
raise NoOutputInExternalRepoError(url, path)