#DOCUMENTATION by Stefan Reise
authorsr
Fri, 06 Sep 2019 16:09:52 +0200
changeset 24733 ebc425f222f9
parent 24732 26eebb19b868
child 24734 008f54b2eb48
#DOCUMENTATION by Stefan Reise method variable renamed, only & docu class: GenericException class comment/format in: #exception:isHandledIn: #handlerContextForException:in: #handlerForSignal:context:originator: #isHandled
GenericException.st
--- a/GenericException.st	Fri Sep 06 16:09:14 2019 +0200
+++ b/GenericException.st	Fri Sep 06 16:09:52 2019 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1993 by Claus Gittinger
 	      All Rights Reserved
@@ -432,11 +434,14 @@
     "Modified (comment): / 28-08-2018 / 11:14:59 / Claus Gittinger"
 !
 
-exception:anException isHandledIn:aContext
-    "return true, if there is a handler for anException in the
+exception:anExceptionClass isHandledIn:aContext
+    "utility:
+     return true, if there is a handler for anException in the
      contextChain starting with aContext."
 
-    ^ (self handlerContextForException:anException in:aContext) notNil
+    ^ (self handlerContextForException:anExceptionClass in:aContext) notNil
+
+    "Modified (comment): / 06-09-2019 / 15:54:45 / Stefan Reise"
 !
 
 exceptionHandlerFor:anException in:aContext
@@ -453,8 +458,9 @@
     ^ nil
 !
 
-handlerContextForException:anException in:aContext
-    "return a handlerContext for anException in the
+handlerContextForException:anExceptionClass in:aContext
+    "utility:
+     return a handlerContext for anException in the
      contextChain starting with aContext.
      Returns nil, if there is no handler."
 
@@ -462,46 +468,49 @@
 
     theContext := aContext findExceptional.
     [theContext notNil] whileTrue:[
-	theContext isRaiseContext ifTrue:[
-	    "skip all the contexts between the raise and the sender of #handle:do"
-	    ex1 := theContext receiver.              "exception, that has been raised"
-	    con1 := ex1 handlerContext.              "the context of the #handle:do:"
-	    con1 notNil ifTrue:[
-		"handlerContext may be nil, if this is a default action"
-		theContext := con1.
-	    ].
-	    ex1 := con1 := nil.
-	] ifFalse:[ |r|
-	    ((r := theContext receiver) notNil
-	     and:[(r handlerForSignal:anException context:theContext originator:nil) notNil]
-	    ) ifTrue:[
-		"found a handler context"
-		^ theContext
-	    ].
-	].
-	theContext notNil ifTrue:[
-	    theContext := theContext findSpecialHandle:true raise:true.
-	].
+        theContext isRaiseContext ifTrue:[
+            "skip all the contexts between the raise and the sender of #handle:do"
+            ex1 := theContext receiver.              "exception, that has been raised"
+            con1 := ex1 handlerContext.              "the context of the #handle:do:"
+            con1 notNil ifTrue:[
+                "handlerContext may be nil, if this is a default action"
+                theContext := con1.
+            ].
+            ex1 := con1 := nil.
+        ] ifFalse:[ |r|
+            ((r := theContext receiver) notNil
+             and:[(r handlerForSignal:anExceptionClass context:theContext originator:nil) notNil]
+            ) ifTrue:[
+                "found a handler context"
+                ^ theContext
+            ].
+        ].
+        theContext notNil ifTrue:[
+            theContext := theContext findSpecialHandle:true raise:true.
+        ].
     ].
 
     ^ nil
+
+    "Modified (comment): / 06-09-2019 / 15:52:49 / Stefan Reise"
 !
 
-handlerForSignal:signal context:theContext originator:originator
+handlerForSignal:exceptionCreator context:theContext originator:originator
     "answer the handler block for the signal from originator.
      The block is retrieved from aContext.
      Answer nil if the signal is not handled"
 
     (theContext selector ~~ #'handle:from:do:'
      or:[(theContext argAt:2) == originator]) ifTrue:[
-	(self == signal or:[self accepts:signal]) ifTrue:[
-	    ^ (theContext argAt:1) ? [nil]
-	]
+        (self == exceptionCreator or:[self accepts:exceptionCreator]) ifTrue:[
+            ^ (theContext argAt:1) ? [nil]
+        ]
     ].
 
     ^ nil
 
-    "Created: / 25.7.1999 / 19:52:58 / stefan"
+    "Created: / 25-07-1999 / 19:52:58 / stefan"
+    "Modified (format): / 06-09-2019 / 15:48:12 / Stefan Reise"
 !
 
 handlerProtectedBlock:doBlock inContext:context
@@ -547,13 +556,14 @@
 !
 
 isHandled
-    "return true, if there is a handler for the receiver signal.
+    "return true, if there is a handler for the receiver signal/exception class.
      Raising an unhandled signal will usually lead into the debugger,
      but can be caught globally by setting Exceptions EmergencyHandler."
 
     ^ self exception:self isHandledIn:(thisContext sender).
 
-    "Created: / 23.7.1999 / 14:03:50 / stefan"
+    "Created: / 23-07-1999 / 14:03:50 / stefan"
+    "Modified (comment): / 06-09-2019 / 15:54:31 / Stefan Reise"
 !
 
 isHandledIn:aContext