Skip to content

Commit 569e556

Browse files
committed
Trap AttributeError and KeyError in config parsing and rethrow with better error message.
1 parent 5a1873d commit 569e556

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pyre/inventory/cfg/CodecConfig.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def _decode(self, shelf):
3434
basename = splitext(fn)[0]
3535
macros = { 'td': td, 'basename': basename }
3636
parser = Parser(root, macros=macros)
37-
parser.read(shelf.name)
37+
try:
38+
parser.read(shelf.name)
39+
except (AttributeError, KeyError) as err:
40+
raise AttributeError("Error parsing '{fp.name}' line {fp.lineno}".format(fp=parser._sections.fp))
3841
shelf['inventory'] = root
3942
shelf._frozen = True
4043
return

0 commit comments

Comments
 (0)