Bug 1333564 - [manifestparser] Include manifest path when raising exceptions from the ini parser, r=jmaher

MozReview-Commit-ID: 3Ns9PxVnvy5

--HG--
extra : rebase_source : 24a07462052aba712e8a2b8b1fe78ade3b1f0c5e
This commit is contained in:
Andrew Halberstadt 2017-01-25 15:51:06 -05:00
Родитель 44a16cbe8a
Коммит 425c00ead0
1 изменённых файлов: 3 добавлений и 6 удалений

Просмотреть файл

@ -89,7 +89,8 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
# if there aren't any sections yet, something bad happen
if not section_names:
raise Exception('No sections found')
raise Exception("Error parsing manifest file '%s', line %s: No sections found" %
(getattr(fp, 'name', 'unknown'), linenum))
# (key, value) pair
for separator in separators:
@ -113,12 +114,8 @@ def read_ini(fp, variables=None, default='DEFAULT', defaults_only=False,
current_section[key] = value
else:
# something bad happened!
if hasattr(fp, 'name'):
filename = fp.name
else:
filename = 'unknown'
raise Exception("Error parsing manifest file '%s', line %s" %
(filename, linenum))
(getattr(fp, 'name', 'unknown'), linenum))
# server-root is a special os path declared relative to the manifest file.
# inheritance demands we expand it as absolute