Changeset 2443
- Timestamp:
- 06/14/09 18:44:18
- Files:
-
- trunk/cherrypy/process/wspbus.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/process/wspbus.py
r2366 r2443 73 73 import warnings 74 74 75 76 75 # Here I save the value of os.getcwd(), which, if I am imported early enough, 77 76 # will be the directory from which the startup script was run. This is needed … … 81 80 # sys.executable is a relative-path, and/or cause other problems). 82 81 _startup_cwd = os.getcwd() 82 83 class ChannelFailures(Exception): 84 delimiter = '\n' 85 86 def __init__(self, *args, **kwargs): 87 super(ChannelFailures, self).__init__(*args, **kwargs) 88 self._exceptions = list() 89 90 def handle_exception(self): 91 self._exceptions.append(sys.exc_info()) 92 93 def get_instances(self): 94 return [instance for cls, instance, traceback in self._exceptions] 95 96 def __str__(self): 97 exception_strings = map(repr, self.get_instances()) 98 return self.delimiter.join(exception_strings) 99 100 def __nonzero__(self): 101 return bool(self._exceptions) 83 102 84 103 # Use a flag to indicate the state of the bus. … … 145 164 return [] 146 165 147 exc = None166 exc = ChannelFailures() 148 167 output = [] 149 168 … … 162 181 raise 163 182 except: 164 exc = sys.exc_info()[1]183 exc.handle_exception() 165 184 if channel == 'log': 166 185 # Assume any further messages to 'log' will fail. … … 170 189 level=40, traceback=True) 171 190 if exc: 172 raise 191 raise exc 173 192 return output 174 193

