class: GenericException
authorClaus Gittinger <cg@exept.de>
Tue, 21 May 2013 22:26:48 +0200
changeset 15311 6cd342b231f2
parent 15310 4c9391898ad2
child 15312 2c69166c1fb2
class: GenericException changed: #return #return: #returnDoing: change reraising during unwing actions (as dicussed with sv). To be watched...
GenericException.st
--- a/GenericException.st	Tue May 21 22:18:45 2013 +0200
+++ b/GenericException.st	Tue May 21 22:26:48 2013 +0200
@@ -1194,9 +1194,12 @@
 !
 
 creator
-    "return the creator of the exception"
-
-    signal notNil ifTrue:[^ signal] ifFalse:[^ self class]
+    "return the creator of the exception;
+     same as signal, for compatibility"
+
+    ^ signal ? self class
+
+    "Modified: / 10-08-2010 / 09:23:18 / cg"
 !
 
 errorString
@@ -1393,7 +1396,10 @@
      the creator. Marked as obsolete, until the change is done!!"
 
     self obsoleteMethodWarning:'meaning of #signal will change. Use #creator'.
-    ^ self creator.
+
+    ^ signal ? self class
+
+    "Modified: / 10-08-2010 / 09:22:33 / cg"
 !
 
 suspendedContext
@@ -1454,7 +1460,7 @@
     "
      try per signal handler
     "
-    (handlerBlock := self creator handlerBlock) notNil ifTrue:[
+    (handlerBlock := signal handlerBlock) notNil ifTrue:[
         "... and call it"
         ^ handlerBlock value:self.
     ].
@@ -1683,12 +1689,9 @@
     |con|
 
     con := handlerContext.
+    thisContext evaluateUnwindActionsUpTo:con.
     handlerContext := suspendedContext := raiseContext := nil.
-    con unwindAndRestart.
-
-"/    thisContext evaluateUnwindActionsUpTo:con.
-"/    handlerContext := suspendedContext := raiseContext := nil.
-"/    con restart
+    con restart
 
     "
      |rslt n|
@@ -1719,11 +1722,9 @@
 "/    ].
 
     con receiver handlerProtectedBlock:aBlock inContext:con.
-"/    thisContext evaluateUnwindActionsUpTo:con.
-"/    handlerContext := suspendedContext := raiseContext := nil.
-"/    con restart
+    thisContext evaluateUnwindActionsUpTo:con.
     handlerContext := suspendedContext := raiseContext := nil.
-    con unwindAndRestart.
+    con restart
 
     "
      |sig rslt|
@@ -1796,7 +1797,7 @@
 return
     "Continue after the handle:do: - the handle:do: returns nil"
 
-    |con value|
+    |con|
 
     con := handlerContext.
     "/ cg: moving the following clearing of the handlerContext
@@ -1808,11 +1809,10 @@
     "/ these are unmarkedForUnwind anyway, so there should be no danger
     "/ for endless recursion here... (i.e. each unwind action can at most
     "/ reraise that exception once).
-    value := self defaultReturnValue.   "/ evaluate before unwinding
     handlerContext := suspendedContext := raiseContext := nil.
     thisContext evaluateUnwindActionsUpTo:con.
     "/ handlerContext := suspendedContext := raiseContext := nil.
-    con return:value
+    con return:(self defaultReturnValue)
 
     "Modified: / 7.9.2001 / 13:29:34 / cg"
 !
@@ -1884,8 +1884,8 @@
 
     |sigDescr|
 
-    sigDescr := self creator description.
-    (messageText isNil or:[messageText isString not])
+    sigDescr := signal description.
+    (messageText isNil or:[ messageText isString not])
     ifTrue:[
         ^ sigDescr
     ].
@@ -1926,7 +1926,7 @@
     self mayProceed ifFalse:[
         StrictRaising ifTrue:[
             "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
-            WrongProceedabilityError raiseRequestWith:self creator.
+            WrongProceedabilityError raiseRequestWith:signal
         ] ifFalse:[
             self class name infoPrint.
             ' [warning]: raised with wrong proceedability' infoPrintCR.
@@ -1987,16 +1987,16 @@
 
     "is nil a valid originator? If so, we need an extra
      instanceVariable to record the originator setting"
+
     originator isNil ifTrue:[
         originator := suspendedContext homeReceiver
     ].
-
     signal isNil ifTrue:[
         signal := self class
     ] ifFalse:[
         signal isExceptionCreator ifFalse:[
             "not an exception or Signal - there is something wrong here..."
-            SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
+            Error "GenericException" raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
         ]
     ].
 
@@ -2021,12 +2021,9 @@
                  Maybe we should better treat a default action like a #handle:do:
                  at the outest level. But the DebugView currently can't handle this,
                  because it tries to raise e.g. AbortOperationRequest even if it has bee invoked
-                 by e.g. NoHandlerError.
-
-                 Note that if raiseContext is nil, the exception
-                 did already return."
-
-                (ex1 creator == signal and:[ex1 raiseContext notNil]) ifTrue:[
+                 by e.g. NoHandlerError"
+
+                (ex1 creator == signal) ifTrue:[
                     "the same exception that has been cought by a default action is raised again.
                      don't recurse"
                     ^ self noHandler.
@@ -2353,11 +2350,11 @@
 !GenericException class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.141 2013-05-27 14:13:24 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.139 2013-05-21 20:26:48 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.141 2013-05-27 14:13:24 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.139 2013-05-21 20:26:48 cg Exp $'
 ! !