mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Handle XML errors when parsing the manifest
Catch ExpatError and exit gracefully with an error message, rather than exiting with a python traceback. Change-Id: Ifd0a7762aab4e8de63dab8a66117170a05586866
This commit is contained in:
parent
1ad7b555df
commit
f7fc8a95be
@ -310,7 +310,11 @@ class XmlManifest(object):
|
|||||||
self._loaded = True
|
self._loaded = True
|
||||||
|
|
||||||
def _ParseManifestXml(self, path, include_root):
|
def _ParseManifestXml(self, path, include_root):
|
||||||
|
try:
|
||||||
root = xml.dom.minidom.parse(path)
|
root = xml.dom.minidom.parse(path)
|
||||||
|
except (OSError, xml.parsers.expat.ExpatError), e:
|
||||||
|
raise ManifestParseError("error parsing manifest %s: %s" % (path, e))
|
||||||
|
|
||||||
if not root or not root.childNodes:
|
if not root or not root.childNodes:
|
||||||
raise ManifestParseError("no root node in %s" % (path,))
|
raise ManifestParseError("no root node in %s" % (path,))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user