[Opensrf-commits] r1200 - trunk/src/python/osrf

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Jan 6 15:47:12 EST 2008


Author: erickson
Date: 2008-01-06 15:22:57 -0500 (Sun, 06 Jan 2008)
New Revision: 1200

Modified:
   trunk/src/python/osrf/ex.py
Log:
made exceptions a litte more generic, passing msg to superclass for networexception

Modified: trunk/src/python/osrf/ex.py
===================================================================
--- trunk/src/python/osrf/ex.py	2008-01-05 19:07:02 UTC (rev 1199)
+++ trunk/src/python/osrf/ex.py	2008-01-06 20:22:57 UTC (rev 1200)
@@ -20,17 +20,14 @@
 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."""



More information about the opensrf-commits mailing list