[Fedora-livecd-list] [patch 00/20] Fix error handling and misc. cleanups
Mark McLoughlin
markmc at redhat.com
Tue Mar 27 14:14:38 UTC 2007
Hi,
Apologies for spamming the list with 20 mails, but hopefully
it'll make it easier to review the patches.
The background to this is that I was suprised to see that
livecd-creator had rather poor error handling (e.g. not unmounting
stuff after certain errors, obscure error messages etc.) since
I thought that was the main reason to re-write pilgrim in python :-)
It's understandable, though. Because Python has exceptions,
it's easy to be fooled into thinking you have error conditions
under control, but in reality, exceptions probably makes it easier
to screw up error handling.
So, here's an attempt to fix it based on the following
guidelines:
- don't intercept an exception if you can't do something useful
with it. Corollary: intercept an exception if you can do something
useful with it.
- anticipate user errors or user-fixable system errors in a user
friendly manner. Corollary: allow other types of exceptions
to be passed to the toplevel.
- i.e. there are 3 types of errors/exceptions, and 3 different
strategies for handling them:
1) errors which we can handle ourselves without ever telling
the user - e.g. a directory which we wish to create already
exists
2) user errors, or predictable system errors, which we
should do our best to help the user out with - e.g.
a busted kickstart file or running out of loop devices
3) pathological system errors or programmer errors, all
of which can be just allowed to propogate up to the
toplevel where an ugly traceback will be printed -
e.g creating a dir under the temporary build dir
fails or an unmount fails because we didn't close
the rpmdb
- whatever the error, we should do our best to clean up files,
directories, mounts, etc. which we created
- bear in mind that e.g. Ctrl-C can happen at any time
Also, I've cleanup up various parts of the code as I
worked on the error handling. Those patches come first.
Cheers,
Mark.
--
More information about the Fedora-livecd-list
mailing list