From: Artem Bityutskiy Date: Wed, 22 Jan 2014 10:12:15 +0000 (+0200) Subject: BmapCreate: catch exception from the Filemap module X-Git-Tag: v3.2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ff0fb3892b1bc9c1db925c316af60637dfeb24f5;p=tools%2Fbmap-tools.git BmapCreate: catch exception from the Filemap module 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 --- diff --git a/bmaptools/BmapCreate.py b/bmaptools/BmapCreate.py index 3df1446..7275cd5 100644 --- a/bmaptools/BmapCreate.py +++ b/bmaptools/BmapCreate.py @@ -171,7 +171,11 @@ class BmapCreate(object): 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)