diff options
author | Michael E Brown <mebrown@michaels-house.net> | 2007-11-30 11:51:25 -0600 |
---|---|---|
committer | Michael E Brown <mebrown@michaels-house.net> | 2007-11-30 11:51:25 -0600 |
commit | 97f06be255f9a20613c66510e05f68372af7215f (patch) | |
tree | 2d57f70b6889bd351f3efac9f32ae806faa53aee /py/mock/exception.py | |
parent | 96dd05c47ed25102fe92a1c7810d12716083e05e (diff) | |
download | mock-97f06be255f9a20613c66510e05f68372af7215f.tar.gz mock-97f06be255f9a20613c66510e05f68372af7215f.tar.xz mock-97f06be255f9a20613c66510e05f68372af7215f.zip |
move things around so that we can run mock.py from the build tree instead of having to install it.
Diffstat (limited to 'py/mock/exception.py')
-rw-r--r-- | py/mock/exception.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/py/mock/exception.py b/py/mock/exception.py new file mode 100644 index 0000000..aee93b9 --- /dev/null +++ b/py/mock/exception.py @@ -0,0 +1,68 @@ +# vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=python:textwidth=0: +# License: GPL2 or later see COPYING +# Originally written by Seth Vidal +# Sections taken from Mach by Thomas Vander Stichele +# Major reorganization and adaptation by Michael Brown +# Copyright (C) 2007 Michael E Brown <mebrown@michaels-house.net> + +# python library imports +from exceptions import Exception + +# our imports + +# classes +class Error(Exception): + def __init__(self, msg): + Exception.__init__(self) + self.msg = msg + self.resultcode = 1 + + def __str__(self): + return self.msg + +# result/exit codes +# 0 = yay! +# 1 = something happened - it's bad +# 5 = cmdline processing error +# 10 = problem building the package +# 20 = error in the chroot of some kind +# 30 = Yum emitted an error of some sort +# 40 = some error in the pkg we're building +# 50 = tried to fork a subcommand and it errored out +# 60 = buildroot locked + +class BuildError(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 10 + +class RootError(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 20 + +class YumError(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 30 + +class PkgError(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 40 + +class BuildRootLocked(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 60 + +class BadCmdline(Error): + def __init__(self, msg): + Error.__init__(self, msg) + self.msg = msg + self.resultcode = 05 |