mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-13 17:16:23 +01: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:
parent
f8f4119b88
commit
92dbd59814
@ -2296,7 +2296,12 @@ rev: %s
|
|||||||
si = Serviceinfo()
|
si = Serviceinfo()
|
||||||
if os.path.exists('_service'):
|
if os.path.exists('_service'):
|
||||||
if self.filenamelist.count('_service') or self.filenamelist_unvers.count('_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.read(service)
|
||||||
si.getProjectGlobalServices(self.apiurl, self.prjname, self.name)
|
si.getProjectGlobalServices(self.apiurl, self.prjname, self.name)
|
||||||
r = si.execute(self.absdir, mode, singleservice, verbose)
|
r = si.execute(self.absdir, mode, singleservice, verbose)
|
||||||
|
Loading…
Reference in New Issue
Block a user