BmapCreate: handle flush() exception
authorArtem Bityutskiy <artem.bityutskiy@intel.com>
Fri, 23 Nov 2012 07:25:17 +0000 (09:25 +0200)
committerArtem Bityutskiy <artem.bityutskiy@intel.com>
Fri, 23 Nov 2012 11:22:17 +0000 (13:22 +0200)
We handle file.flush() exceptions for the image, but not for bmap. This is
inconsistent. Let's handle them for both.

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

index 45bceaf..6a02af5 100644 (file)
@@ -323,7 +323,11 @@ class BmapCreate:
 
         self._bmap_file_end()
 
-        self._f_bmap.flush()
+        try:
+            self._f_bmap.flush()
+        except IOError as err:
+            raise Error("cannot flush the bmap file '%s': %s" \
+                        % (self._bmap_path, err))
 
         self._f_image.seek(image_pos)