Improve error handling.
authormeisterluk <admin@lukas-prokop.at>
Fri, 3 May 2013 16:10:11 +0000 (18:10 +0200)
committerMichael Prokop <mika@grml.org>
Mon, 13 May 2013 09:04:14 +0000 (11:04 +0200)
In method unmount: If unmount impossible, write a message to logging
before it finally raises (fixes inconsistency with other error handling).

In method copy_bootloader_files: Provide an Exception instance to provide
an useful error message.

grml2usb

index 66ff2ee..fa820bf 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -663,6 +663,7 @@ def unmount(target, unmount_options):
         proc = subprocess.Popen(["umount"] + list(unmount_options) + [target])
         proc.wait()
         if proc.returncode != 0:
+            logging.critical("Error executing umount")
             raise Exception("Error executing umount")
         else:
             logging.debug("unregister_mountpoint(%s)", target)
@@ -1049,7 +1050,7 @@ def copy_bootloader_files(iso_mount, target, grml_flavour):
         logging.critical("Fatal: file default.cfg could not be found.")
         logging.critical("Note:  this grml2usb version requires an ISO generated by grml-live >=0.9.24 ...")
         logging.critical("       ... either use grml releases >=2009.10 or switch to an older grml2usb version.")
-        raise
+        raise CriticalException("file default.cfg could not be found.")
 
     if not os.path.exists(iso_mount + '/boot/grub/footer.cfg'):
         logging.warning("Warning: Grml releases older than 2011.12 support only one flavour in grub.")