From 14a5633ea3e76ab33e09cac5a328bc021e7dae78 Mon Sep 17 00:00:00 2001 From: erickson Date: Sun, 6 Jan 2008 20:22:57 +0000 Subject: [PATCH 1/1] made exceptions a litte more generic, passing msg to superclass for networexception git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1200 9efc2488-bf62-4759-914b-345cdb29e865 --- src/python/osrf/ex.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/python/osrf/ex.py b/src/python/osrf/ex.py index af7177e..f62aca8 100644 --- a/src/python/osrf/ex.py +++ b/src/python/osrf/ex.py @@ -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.""" -- 2.43.2