From 3910eb6065c8f615bbd75ab8b1653f1f6e5206a4 Mon Sep 17 00:00:00 2001 From: "Mr. Outis" Date: Mon, 19 Nov 2018 20:52:25 -0600 Subject: [PATCH] metrics add: Raise exception when path does not exist Fix #1316 --- dvc/project.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dvc/project.py b/dvc/project.py index 5763bc2c7..a93a8abbf 100644 --- a/dvc/project.py +++ b/dvc/project.py @@ -1023,6 +1023,9 @@ class Project(object): self._metrics_modify(path, typ, xpath) def metrics_add(self, path, typ=None, xpath=None): + if not os.path.exists(path): + raise DvcException('File does not exist'.format(path)) + if not typ: typ = 'raw' self._metrics_modify(path, typ, xpath)