Optional code to make the default handler action to proceed.
authorStefan Vogel <sv@exept.de>
Mon, 24 Jan 2005 18:37:27 +0100
changeset 8701 bd5034470a47
parent 8700 c416a3fb7e2f
child 8702 bb40a9b11f11
Optional code to make the default handler action to proceed.
Notification.st
--- a/Notification.st	Mon Jan 24 18:36:09 2005 +0100
+++ b/Notification.st	Mon Jan 24 18:37:27 2005 +0100
@@ -40,8 +40,10 @@
 documentation
 "    
     Notification is the superclass of all notification exceptions in the system.
-    These notifications are ignored, if no handler is present.
+    Notifications are ignored, if no handler is present.
     In this case a default value is returned.
+    When a handler finishes, the do-block is proceeded with the exception handlers value
+    (an Exception does a return in this case.).
 
     [author:]
         Stefan Vogel
@@ -49,7 +51,6 @@
     [see also:]
         Signal QuerySignal
 "
-
 !
 
 examples 
@@ -280,6 +281,33 @@
     "Modified: / 23.7.1999 / 15:13:34 / stefan"
 ! !
 
+!Notification methodsFor:'private'!
+
+LATERdoCallHandler:aHandlerBlock
+"SV: Have to think about..."
+    "call the handler proper
+     - an extra method is needed to have a raise-marked context around.
+       (see implementation of #reject and #proceed).
+     Redefined from GenericException to do a proceed here"
+
+    <context: #return>
+    <exception: #raise>
+
+    |val|
+
+    aHandlerBlock argumentCount == 0 ifTrue:[
+        "/ 0-arg handler - not interested in the ex - object
+        val := aHandlerBlock value
+    ] ifFalse:[
+        "/ 1-arg handler - pass myself as exception argument
+        val := aHandlerBlock value:self.
+    ].
+
+    "handler fall through - is just like a #proceedWith:(aHandlerBlock value)"
+
+    self proceedWith:val
+! !
+
 !Notification methodsFor:'testing'!
 
 isNotification
@@ -289,7 +317,7 @@
 !Notification class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.17 2005-01-24 12:33:39 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Notification.st,v 1.18 2005-01-24 17:37:27 stefan Exp $'
 ! !
 
 Notification initialize!