mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-04 15:28:27 +01:00
state: capture exception if unable to parse target metrics
Fixes #265 Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
+7
-1
@@ -113,7 +113,13 @@ class StateFile(object):
|
||||
|
||||
@staticmethod
|
||||
def parse_target_metric(file_name):
|
||||
lines = open(file_name).readlines(2)
|
||||
fd = open(file_name, 'r')
|
||||
|
||||
try:
|
||||
lines = fd.readlines(2)
|
||||
except Exception as e:
|
||||
raise StateFileError('Unable to parse target file')
|
||||
|
||||
if len(lines) != 1:
|
||||
raise StateFileError('file contains more then one line')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user