Repository: iterative/dvc
Issue: get: relpath in error message for inexistent `path` is not nice

UPDATE: See https://github.com/iterative/dvc/issues/2430#issuecomment-524546265

---

~~Example:~~

```console
$ dvc get https://github.com/iterative/dvc.org \\
          I-dont-exist.zip
ERROR: failed to get ' ' from 'https://github.com/iterative/dvc.org' - you are not
inside of a dvc repository (checked up to mount point '/')
...
```
> Note that https://github.com/iterative/dvc.org is NOT a DVC project.

First of all, the command takes a long time to error out.

Also, `you are not inside of a dvc repository`? I thought `dvc get` "doesn't require an existing DVC project to run in", at least according to [our docs](https://dvc.org/doc/commands-reference/get) (which I wrote 😋).

```console
DVC version: 0.57.0
Python version: 3.7.3
Platform: Darwin-18.7.0-x86_64-i386-64bit
Binary: False
Filesystem type (workspace): ('apfs', '/dev/disk1s1')
```

---

Maybe related to #2309

Changed files:
dvc/repo/get.py, tests/conftest.py, tests/func/test_get.py, dvc/exceptions.py

diff --git a/dvc/exceptions.py b/dvc/exceptions.py
index bddf83ec9..8648f69e7 100644
--- a/dvc/exceptions.py
+++ b/dvc/exceptions.py
@@ -279,3 +279,10 @@ class DvcIgnoreInCollectedDirError(DvcException):
             ".dvcignore file should not be in collected dir path: "
             "'{}'".format(ignore_dirname)
         )
+
+
+class UrlNotDvcRepoError(DvcException):
+    def __init__(self, url):
+        super(UrlNotDvcRepoError, self).__init__(
+            "URL '{}' is not a dvc repository.".format(url)
+        )
diff --git a/dvc/repo/get.py b/dvc/repo/get.py
index e8ea9ba0e..b0e23618a 100644
--- a/dvc/repo/get.py
+++ b/dvc/repo/get.py
@@ -1,13 +1,17 @@
+import logging
 import os
 import shortuuid
 
 from dvc.config import Config
+from dvc.exceptions import NotDvcRepoError, UrlNotDvcRepoError
 from dvc.path_info import PathInfo
 from dvc.external_repo import external_repo
 from dvc.state import StateNoop
 from dvc.utils import remove
 from dvc.utils.compat import urlparse
 
+logger = logging.getLogger(__name__)
+
 
 @staticmethod
 def get(url, path, out=None, rev=None):
@@ -48,5 +52,8 @@ def get(url, path, out=None, rev=None):
             o.path_info = PathInfo(os.path.abspath(out))
             with o.repo.state:
                 o.checkout()
+
+    except NotDvcRepoError:
+        raise UrlNotDvcRepoError(url)
     finally:
         remove(tmp_dir)
diff --git a/tests/conftest.py b/tests/conftest.py
index 3356a4a0b..e9855056d 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -9,8 +9,7 @@ from dvc.remote.config import RemoteConfig
 from dvc.utils.compat import cast_bytes_py2
 from dvc.remote.ssh.connection import SSHConnection
 from dvc.repo import Repo as DvcRepo
-from .basic_env import TestDirFixture, TestDvcGitFixture
-
+from .basic_env import TestDirFixture, TestDvcGitFixture, TestGitFixture
 
 # Prevent updater and analytics from running their processes
 os.environ[cast_bytes_py2("DVC_TEST")] = cast_bytes_py2("true")
@@ -177,3 +176,11 @@ def _close_pools():
 
     yield
     close_pools()
+
+
+@pytest.fixture
+def git_erepo():
+    repo = TestGitFixture()
+    repo.setUp()
+    yield repo
+    repo.tearDown()
diff --git a/tests/func/test_get.py b/tests/func/test_get.py
index b545f1d4a..62d86816d 100644
--- a/tests/func/test_get.py
+++ b/tests/func/test_get.py
@@ -1,6 +1,9 @@
 import os
 import filecmp
 
+import pytest
+
+from dvc.exceptions import UrlNotDvcRepoError
 from dvc.repo import Repo
 
 from tests.utils import trees_equal
@@ -38,3 +41,8 @@ def test_get_repo_rev(repo_dir, erepo):
     assert os.path.isfile(dst)
     with open(dst, "r+") as fobj:
         assert fobj.read() == "branch"
+
+
+def test_get_from_non_dvc_repo(git_erepo):
+    with pytest.raises(UrlNotDvcRepoError):
+        Repo.get(git_erepo.root_dir, "some_file.zip")