Skip to content

Commit

Permalink
Replace underived exceptions with clean exit
Browse files Browse the repository at this point in the history
Fix:

| TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType

Closes: #702874
  • Loading branch information
mika committed Mar 12, 2013
1 parent a9dc6cf commit ba6da05
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions grml2usb
Expand Up @@ -1052,7 +1052,8 @@ 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
cleanup()
sys.exit(1)

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.")
Expand Down Expand Up @@ -1151,10 +1152,13 @@ def identify_grml_flavour(mountpath):
for line in tmpfile.readlines():
flavours.append(get_flavour(line))
except TypeError, e:
raise
logging.critical("Unexpected TypeError: %s", e)
cleanup()
sys.exit(1)
except Exception, e:
logging.critical("Unexpected error: %s", e)
raise
logging.critical("Unexpected Exception error: %s", e)
cleanup()
sys.exit(1)
finally:
if tmpfile:
tmpfile.close()
Expand Down Expand Up @@ -1502,13 +1506,15 @@ def install_grml(mountpoint, device):
mount(device, device_mountpoint, ['-o', 'utf8,iocharset=iso8859-1'])
except VerifyException, error:
logging.critical("Fatal: %s", error)
raise
cleanup()
sys.exit(1)
except CriticalException, error:
try:
mount(device, device_mountpoint, "")
except CriticalException, error:
logging.critical("Fatal: %s", error)
raise
cleanup()
sys.exit(1)
try:
grml_flavours = identify_grml_flavour(mountpoint)
for flavour in set(grml_flavours):
Expand Down

0 comments on commit ba6da05

Please sign in to comment.