From: Artem Bityutskiy Date: Mon, 29 Oct 2012 08:40:35 +0000 (+0200) Subject: bmap-flasher: improve errors handling X-Git-Tag: v1.0~186 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b28570ea34bd897f11485d356c09221ac4702de;p=tools%2Fbmap-tools.git bmap-flasher: improve errors handling Print a nice error message when the the user by a mistake gives us a non-XML file instead of a proper bmap XML file. Change-Id: I1e65122b5c9fffb79c3b6855a74d075430669792 Signed-off-by: Artem Bityutskiy --- diff --git a/bmap-flasher b/bmap-flasher index a2e5a7e..dc0c973 100755 --- a/bmap-flasher +++ b/bmap-flasher @@ -178,7 +178,12 @@ def write_with_bmap(image, f_image, bdev, f_bdev, bmap, f_bmap, verify): from xml.etree import ElementTree - xml = ElementTree.parse(f_bmap) + try: + xml = ElementTree.parse(f_bmap) + except ElementTree.ParseError as err: + raise FlasherException("cannot parse the bmap file '%s' which should " \ + "be a proper XML file: %s" \ + % (bmap, err)) version = xml.getroot().attrib.get('version') check_bmap_version(version)