#FEATURE by stefan
authorStefan Vogel <sv@exept.de>
Fri, 20 Mar 2020 13:00:25 +0100
changeset 25338 7ebc001a5a1b
parent 25337 a072fff084de
child 25339 3fb3b8bd0b19
#FEATURE by stefan class: GenericException added: #isHandledBy: class: GenericException class
GenericException.st
--- a/GenericException.st	Wed Mar 18 15:09:56 2020 +0100
+++ b/GenericException.st	Fri Mar 20 13:00:25 2020 +0100
@@ -2297,6 +2297,32 @@
     "Modified: / 10-08-2010 / 09:26:14 / cg"
 ! !
 
+!GenericException methodsFor:'queries'!
+
+isHandledBy:anExceptionCreator
+    "answer true, if the exception is handles by anExceptionCreator.
+     This is the inverse if GenericException>>#handles:
+     This method is immune to anExceptionCreator being nil."
+
+    anExceptionCreator isNil ifTrue:[
+        ^ false.
+    ]. 
+    ^ anExceptionCreator accepts:self creator.
+
+"/    myCreator := self creator.
+"/    myCreator == anExceptionCreator ifTrue:[^ true].
+"/    "/ the following line depends on this method being redefined in the Notification subclass
+"/    myCreator isQuerySignal ifTrue:[^ false].
+"/
+"/    s := anExceptionCreator.
+"/    [(s := s parent) notNil] whileTrue:[
+"/        myCreator == s ifTrue:[^ true].
+"/    ].
+"/    ^ false
+
+    "Created: / 19-03-2020 / 19:11:01 / Stefan Vogel"
+! !
+
 !GenericException methodsFor:'raising'!
 
 raise