1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

When lxml fails to parse the _service file, instead of showing a backtrace

print a userfriendly error which line and column contains the XML syntax error
This commit is contained in:
Jelle van der Waa 2015-05-13 14:35:17 +02:00
parent f8f4119b88
commit 92dbd59814

View File

@ -2296,7 +2296,12 @@ rev: %s
si = Serviceinfo()
if os.path.exists('_service'):
if self.filenamelist.count('_service') or self.filenamelist_unvers.count('_service'):
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
try:
service = ET.parse(os.path.join(self.absdir, '_service')).getroot()
except ET.ParseError as v:
line, column = v.position
print('XML error in _service file on line %s, column %s' % (line, column))
sys.exit(1)
si.read(service)
si.getProjectGlobalServices(self.apiurl, self.prjname, self.name)
r = si.execute(self.absdir, mode, singleservice, verbose)