BmapCopy: improve XML parsing error message
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Wed, 18 Sep 2013 07:21:37 +0000 (10:21 +0300)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Thu, 19 Sep 2013 10:28:48 +0000 (13:28 +0300)
commit4be13434129cd7444811203d3f657debbd86ef1f
treee804a016d4efd4354153682a25f4c230c9a2ad2e
parent95a8c2d9f1a5f9d786574deb4d934be04ab6aaa1
BmapCopy: improve XML parsing error message

When BmapCopy fails to parse the XML file, it prints something like this:

bmaptool: ERROR: cannot parse the bmap file '/home/dedekind/tmp/Fedora-19-i386-CHECKSUM' which should be a proper XML file: not well-formed (invalid token): line 1, column 1

(yes, I deliberately fed bmaptool a bogus file)

The problem is that sometimes we actually modify the bmap file a bit before
parsing. For example, we do this when the bmap file is signed with a clearsign
OpenPGP signature.

This means that the line number does not match the file name we print. This
patch improves the situation by providing the bogus line number and a bit of
the context in the exception error message.

Change-Id: I62b8aefde4a3ea524f528b83c4b6e70fa469e387
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
bmaptools/BmapCopy.py