summaryrefslogtreecommitdiffstats
path: root/python/exceptions.py
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-05-05 18:01:45 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-05-05 18:01:45 +0000
commit425257ddf930105bea6d648a19e184c74da4177b (patch)
tree2107ff6bc49c56cd2897a023b22a9c3b9ec10312 /python/exceptions.py
parent18ada3395f7498e9028acdb061624c3743f51cf6 (diff)
* python/Makefile.am: changed to use pyexecdir for the binding
shared libraries (Bug#2494) * python/exceptions.py: bring exceptions over from the bindings so they can be used in applications (Bug#2036) Make all exceptions derive from DBusException * python/_dbus.py, python/proxies.py: implement __repr__ in a couple of classes so that print obj doesn't throw an exception (Bug #1685)
Diffstat (limited to 'python/exceptions.py')
-rw-r--r--python/exceptions.py35
1 files changed, 12 insertions, 23 deletions
diff --git a/python/exceptions.py b/python/exceptions.py
index 66b8c566..b9df8150 100644
--- a/python/exceptions.py
+++ b/python/exceptions.py
@@ -1,32 +1,21 @@
-class MissingErrorHandlerException(Exception):
- def __init__(self):
- Exception.__init__(self)
-
-
- def __str__(self):
- return "error_handler not defined: if you define a reply_handler you must also define an error_handler"
+import dbus_bindings
+DBusException = dbus_bindings.DBusException
+ConnectionError = dbus_bindings.ConnectionError
-class MissingReplyHandlerException(Exception):
+class MissingErrorHandlerException(DBusException):
def __init__(self):
- Exception.__init__(self)
+ DBusException.__init__(self, "error_handler not defined: if you define a reply_handler you must also define an error_handler")
- def __str__(self):
- return "reply_handler not defined: if you define an error_handler you must also define a reply_handler"
+class MissingReplyHandlerException(DBusException):
+ def __init__(self):
+ DBusException.__init__(self, "reply_handler not defined: if you define an error_handler you must also define a reply_handler")
-class ValidationException(Exception):
+class ValidationException(DBusException):
def __init__(self, msg=''):
- self.msg = msg
- Exception.__init__(self)
-
- def __str__(self):
- return "Error validating string: %s" % self.msg
+ DBusException.__init__(self, "Error validating string: %s"%msg)
-class UnknownMethodException(Exception):
+class UnknownMethodException(DBusException):
def __init__(self, msg=''):
- self.msg = msg
- Exception.__init__(self)
-
- def __str__(self):
- return "Unknown method: %s" % self.msg
+ DBusException.__init__("Unknown method: %s"%msg)