metrics: don't try to read metrics if file doesn't exist

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-06-16 16:07:51 +03:00
parent 83d831735c
commit 20ba323d18
+5 -1
View File
@@ -321,6 +321,10 @@ class Project(object):
def _read_metric(self, path, json_path=None, tsv_path=None, htsv_path=None):
ret = None
if not os.path.exists(path):
return ret
try:
with open(path, 'r') as fd:
if json_path:
@@ -332,7 +336,7 @@ class Project(object):
else:
ret = fd.read()
except Exception as exc:
self.logger.error('Unable to read metric in \'{}\''.format(path), exc)
self.logger.debug('Unable to read metric in \'{}\''.format(path), exc)
return ret