diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2006-05-08 18:34:42 -0400 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2006-05-08 18:34:42 -0400 |
commit | 804a564ac24ff22cd46583fa98d8140a8b10f476 (patch) | |
tree | fadba99af49b4da97be1a5b7ab7af42cb780db39 /cobbler/collection_distros.py | |
parent | d4f71b4318fedf374844030095c6c8dd544f0e92 (diff) | |
download | third_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.tar.gz third_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.tar.xz third_party-cobbler-804a564ac24ff22cd46583fa98d8140a8b10f476.zip |
Adding exception handling to remove the problem of propogating error codes all the way up the stack. Still not quite super-consistant, but getting there. Util functions still return true/false since they just ask questions, but API functions will throw errors to ensure they are being dealt with. Main CLI class needs to take advantage of this fact and become simpler. Tests are already modified to detect new exceptions with one exception :)
Diffstat (limited to 'cobbler/collection_distros.py')
-rw-r--r-- | cobbler/collection_distros.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cobbler/collection_distros.py b/cobbler/collection_distros.py index 5f49d16..9dde74b 100644 --- a/cobbler/collection_distros.py +++ b/cobbler/collection_distros.py @@ -8,6 +8,7 @@ Michael DeHaan <mdehaan@redhat.com import utils import collection import item_distro as distro +import cexceptions class Distros(collection.Collection): @@ -30,9 +31,9 @@ class Distros(collection.Collection): # first see if any Groups use this distro for v in self.config.profiles(): if v.distro == name: - raise CobblerException("orphan_files") + raise cexceptions.CobblerException("orphan_files") if self.find(name): del self.listing[name] return True - raise CobblerException("delete_nothing") + raise cexceptions.CobblerException("delete_nothing") |