#FEATURE by stefan
class: GenericException
added: #isHandledBy:
class: GenericException class
--- 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