The 'Filemap' module can raise exceptions in case of errors. Let's catch them
and re-raise as 'BmapCreate.Error' exceptions. This will make 'bmaptool' catch
them too and print a nice error message.
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
self._bmap_path = bmap
self._open_bmap_file()
- self.filemap = Filemap.filemap(self._f_image, self._log)
+ try:
+ self.filemap = Filemap.filemap(self._f_image, self._log)
+ except (Filemap.Error, Filemap.ErrorNotSupp) as err:
+ raise Error("cannot generate bmap for file '%s': %s"
+ % (self._image_path, err))
self.image_size = self.filemap.image_size
self.image_size_human = human_size(self.image_size)