|
[Webware-checkins] r84 - Component
From: <ianb@we...> - 2004-04-18 03:59
|
Author: ianb
Date: 2004-04-17 21:59:35 -0600 (Sat, 17 Apr 2004)
New Revision: 84
Modified:
Component/__init__.py
Log:
Added exception handling
Modified: Component/__init__.py
===================================================================
--- Component/__init__.py 2004-04-17 21:58:11 UTC (rev 83)
+++ Component/__init__.py 2004-04-18 03:59:35 UTC (rev 84)
@@ -83,6 +83,24 @@
self.callEvent('sleep', trans)
Page.sleep(self, trans)
+ def runTransaction(self, trans):
+ try:
+ try:
+ self.awake(trans)
+ self.respond(trans)
+ except Exception, e:
+ if self.handleException(e) == 'break':
+ return
+ for component in self._instanceComponents:
+ if component.handleExceptionEvent(e) == 'break':
+ return
+ raise
+ finally:
+ self.sleep(trans)
+
+ def handleException(self, exc):
+ pass
+
components = []
class Component:
@@ -156,8 +174,9 @@
def exceptionHTTPNotFoundEvent(self, exc):
self.servlet().write('...')
- # False means the exception is 'handled':
- return False
+ # returning 'break' means the exception has been
+ # handled and needn't be propagated up:
+ return 'break'
Actual exceptions are simply fired as 'exception' events,
i.e., calling exceptionEvent. By using _handleExceptions
|
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r84 - Component | <ianb@we...> |