diff options
author | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-13 04:00:28 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@sonymobile.com> | 2012-11-13 05:53:41 +0900 |
commit | f7fc8a95beb1337e23f146cad8086c1fc05902ee (patch) | |
tree | 53c36c8d5cd0aee9d30dc62b61cf47af69c94bf7 | |
parent | 1ad7b555df77d27fac485ac2815dd6ce9b8b8dfd (diff) | |
download | git-repo-f7fc8a95beb1337e23f146cad8086c1fc05902ee.tar.gz |
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
-rw-r--r-- | manifest_xml.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/manifest_xml.py b/manifest_xml.py index cdee87a6..bf981f03 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -310,7 +310,11 @@ class XmlManifest(object): | |||
310 | self._loaded = True | 310 | self._loaded = True |
311 | 311 | ||
312 | def _ParseManifestXml(self, path, include_root): | 312 | def _ParseManifestXml(self, path, include_root): |
313 | root = xml.dom.minidom.parse(path) | 313 | try: |
314 | root = xml.dom.minidom.parse(path) | ||
315 | except (OSError, xml.parsers.expat.ExpatError), e: | ||
316 | raise ManifestParseError("error parsing manifest %s: %s" % (path, e)) | ||
317 | |||
314 | if not root or not root.childNodes: | 318 | if not root or not root.childNodes: |
315 | raise ManifestParseError("no root node in %s" % (path,)) | 319 | raise ManifestParseError("no root node in %s" % (path,)) |
316 | 320 | ||