Better error message on "file not found"

This commit is contained in:
Sebastian Lohff 2015-08-17 00:19:32 +02:00
parent 0c5d94d211
commit 9860896d20
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ class Questions(object):
self._gen_error(filename, "Section element %d is not a string (type %s found)" % (n, type(sec_filename)))
fpath = os.path.join(basedir, sec_filename)
sec_ysrc = None
try:
sec_ysrc = self._get_yaml(fpath)
except (OSError, IOError) as e:
raise QuestionException("Error reading question file %s: %s" % (fpath, str(e)))
self._read_sections(sec_ysrc, fpath)
def _read_sections(self, ysrc, filename):