Make exiting with message a function of the exception
Signed-off-by: martin f. krafft <madduck@madduck.net>
diff --git a/reclass/errors.py b/reclass/errors.py
index bb81e19..66b1839 100644
--- a/reclass/errors.py
+++ b/reclass/errors.py
@@ -7,7 +7,7 @@
# Released under the terms of the Artistic Licence 2.0
#
-import posix
+import posix, sys
class ReclassException(Exception):
@@ -20,6 +20,10 @@
rc = property(lambda self: self._rc)
+ def exit_with_message(self, out=sys.stderr):
+ print >>out, self.message
+ sys.exit(self.rc)
+
class InvocationError(ReclassException):