--- a/GenericException.st Wed Aug 09 22:42:33 2006 +0200
+++ b/GenericException.st Thu Aug 10 00:18:47 2006 +0200
@@ -379,15 +379,37 @@
"Created: / 23.7.1999 / 14:00:47 / stefan"
!
-exception:anExceptionHandler isHandledIn:aContext
- "return true, if there is a handler for the receiver signal in the
+exception:anException isHandledIn:aContext
+ "return true, if there is a handler for anException in the
contextChain starting with aContext."
- |theContext|
+ ^ (self handlerContextForException:anException in:aContext) notNil
+!
+
+exceptionHandlerFor:anException in:aContext
+ "answer the exceptionHandler-block for anException from aContext."
+
+ |sel|
+
+ sel := aContext selector.
+ (sel == #'handle:from:do:'
+ or:[sel == #'handle:do:']) ifTrue:[
+ ^ aContext receiver
+ ].
+
+ ^ nil
+!
+
+handlerContextForException:anException in:aContext
+ "return a handlerContext for anException in the
+ contextChain starting with aContext.
+ Returns nil ,if there is no handler."
+
+ |theContext ex1 con1|
theContext := aContext findExceptional.
[theContext notNil] whileTrue:[
- theContext isRaiseContext ifTrue:[ |ex1 con1|
+ 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:"
@@ -398,10 +420,10 @@
ex1 := con1 := nil.
] ifFalse:[ |r|
((r := theContext receiver) notNil
- and:[(r handlerForSignal:anExceptionHandler context:theContext originator:nil) notNil]
+ and:[(r handlerForSignal:anException context:theContext originator:nil) notNil]
) ifTrue:[
"found a handler context"
- ^ true
+ ^ theContext
].
].
theContext notNil ifTrue:[
@@ -409,20 +431,6 @@
].
].
- ^ false
-!
-
-exceptionHandlerFor:anException in:aContext
- "answer the exceptionHandler for anException from aContext."
-
- |sel|
-
- sel := aContext selector.
- (sel == #'handle:from:do:'
- or:[sel == #'handle:do:']) ifTrue:[
- ^ aContext receiver
- ].
-
^ nil
!
@@ -1960,7 +1968,7 @@
!GenericException class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.102 2006-03-14 12:54:37 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/GenericException.st,v 1.103 2006-08-09 22:18:47 cg Exp $'
! !
GenericException initialize!