Silent error for StandardError, not RuntimeError
authorLukas Prokop <admin@lukas-prokop.at>
Wed, 19 Feb 2014 22:48:08 +0000 (23:48 +0100)
committerLukas Prokop <admin@lukas-prokop.at>
Wed, 19 Feb 2014 22:54:00 +0000 (23:54 +0100)
RuntimeError was caught to catch set modification during iteration.
Now I want to catch all system-related exception.

grml2usb

index 94f73ed..cdbb3e8 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -174,7 +174,7 @@ def cleanup():
         try:
             unmount(device, "")
             logging.debug('Unmounted %s' % device)
         try:
             unmount(device, "")
             logging.debug('Unmounted %s' % device)
-        except RuntimeError:
+        except StandardError:
             logging.debug('RuntimeError while umount %s, ignoring' % device)
 
     for tmppath in TMPFILES.copy():
             logging.debug('RuntimeError while umount %s, ignoring' % device)
 
     for tmppath in TMPFILES.copy():
@@ -189,7 +189,7 @@ def cleanup():
                 os.unlink(tmppath)
                 logging.debug('temporary file %s deleted' % tmppath)
                 unregister_tmpfile(tmppath)
                 os.unlink(tmppath)
                 logging.debug('temporary file %s deleted' % tmppath)
                 unregister_tmpfile(tmppath)
-        except RuntimeError:
+        except StandardError:
             msg = 'RuntimeError while removing temporary %s, ignoring'
             logging.debug(msg % tmppath)
 
             msg = 'RuntimeError while removing temporary %s, ignoring'
             logging.debug(msg % tmppath)