class: GenericException
authorStefan Vogel <sv@exept.de>
Mon, 27 May 2013 16:13:24 +0200
changeset 15286 83f48c5b9ed9
parent 15285 7c7d4ed8296d
child 15287 58ad2059c738
class: GenericException changed:6 methods reduce direct access to instance variable 'signal'
GenericException.st
--- a/GenericException.st	Mon May 27 16:12:02 2013 +0200
+++ b/GenericException.st	Mon May 27 16:13:24 2013 +0200
@@ -1194,12 +1194,9 @@
 !
 
 creator
-    "return the creator of the exception;
-     same as signal, for compatibility"
-
-    ^ signal ? self class
-
-    "Modified: / 10-08-2010 / 09:23:18 / cg"
+    "return the creator of the exception"
+
+    signal notNil ifTrue:[^ signal] ifFalse:[^ self class]
 !
 
 errorString
@@ -1396,10 +1393,7 @@
      the creator. Marked as obsolete, until the change is done!!"
 
     self obsoleteMethodWarning:'meaning of #signal will change. Use #creator'.
-
-    ^ signal ? self class
-
-    "Modified: / 10-08-2010 / 09:22:33 / cg"
+    ^ self creator.
 !
 
 suspendedContext
@@ -1460,7 +1454,7 @@
     "
      try per signal handler
     "
-    (handlerBlock := signal handlerBlock) notNil ifTrue:[
+    (handlerBlock := self creator handlerBlock) notNil ifTrue:[
         "... and call it"
         ^ handlerBlock value:self.
     ].
@@ -1890,8 +1884,8 @@
 
     |sigDescr|
 
-    sigDescr := signal description.
-    (messageText isNil or:[ messageText isString not])
+    sigDescr := self creator description.
+    (messageText isNil or:[messageText isString not])
     ifTrue:[
         ^ sigDescr
     ].
@@ -1932,7 +1926,7 @@
     self mayProceed ifFalse:[
         StrictRaising ifTrue:[
             "/ proceeding from wrongProceedabilitySignal grants the raiseRequest
-            WrongProceedabilityError raiseRequestWith:signal
+            WrongProceedabilityError raiseRequestWith:self creator.
         ] ifFalse:[
             self class name infoPrint.
             ' [warning]: raised with wrong proceedability' infoPrintCR.
@@ -1993,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..."
-            Error "GenericException" raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
+            SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'.
         ]
     ].
 
@@ -2027,9 +2021,12 @@
                  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"
-
-                (ex1 creator == signal) ifTrue:[
+                 by e.g. NoHandlerError.
+
+                 Note that if raiseContext is nil, the exception
+                 did already return."
+
+                (ex1 creator == signal and:[ex1 raiseContext notNil]) ifTrue:[
                     "the same exception that has been cought by a default action is raised again.
                      don't recurse"
                     ^ self noHandler.
@@ -2356,11 +2353,11 @@
 !GenericException class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.140 2013-05-24 18:14:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.141 2013-05-27 14:13:24 stefan Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.140 2013-05-24 18:14:44 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.141 2013-05-27 14:13:24 stefan Exp $'
 ! !