raise an exception when the xmpp recipient is not found. http_translator turns this...
[OpenSRF.git] / src / python / osrf / ex.py
index af7177e..d7395d5 100644 (file)
 class OSRFException(Exception):
     """Root class for exceptions."""
     def __init__(self, info=None):
-        self.info = info;
+        self.msg = '%s: %s' % (self.__class__.__name__, info)
     def __str__(self):
-        return self.info
+        return self.msg
 
 
 class NetworkException(OSRFException):
-    def __str__(self):
-        msg = "\nUnable to communicate with the OpenSRF network"
-        if self.info:
-            msg = msg + '\n' + unicode(self.info)
-        return msg
+    def __init__(self):
+        OSRFException.__init__('Error communicating with the OpenSRF network')
 
 class OSRFProtocolException(OSRFException):
     """Raised when something happens during opensrf network stack processing."""
@@ -51,5 +48,3 @@ class OSRFJSONParseException(OSRFException):
     """Raised when a JSON parsing error occurs."""
     pass
 
-
-