diff -r c32b6064d503 -r 1e8814a54967 GenericException.st --- a/GenericException.st Wed Jul 27 21:25:42 2016 +0200 +++ b/GenericException.st Wed Jul 27 21:25:45 2016 +0200 @@ -581,7 +581,7 @@ ^ ret ]. ] ifFalse:[ - "ask the the receiver of the #handle:do: or #on:do: or whatever- message for the handler. + "ask the receiver of the #handle:do: or #on:do: or whatever- message for the handler. nil is returned, if the signal is not accepted" |r| r := con receiver. "receiver of #handle:do: or #on:do:" @@ -1424,24 +1424,24 @@ returnableContext := suspendedContext. returnableContext canReturn ifFalse:[ - "the context that triggered the exception cannot return. - This is a fallback: return the the context of the raise*. - We know, that this context is returnable" - - returnableContext := nextContext := raiseContext. - "find the returnable context that is the nearest in the sender chain - to suspendedContext...." - [ - nextContext := nextContext sender. - nextContext isNil ifTrue:[ - "suspendedContext appears to not exist on sender chain..." - ^ raiseContext. - ]. - nextContext canReturn ifTrue:[ - returnableContext := nextContext. - ]. - nextContext ~~ suspendedContext. - ] whileTrue. + "the context that triggered the exception cannot return. + This is a fallback: return the context of the raise*. + We know, that this context is returnable" + + returnableContext := nextContext := raiseContext. + "find the returnable context that is the nearest in the sender chain + to suspendedContext...." + [ + nextContext := nextContext sender. + nextContext isNil ifTrue:[ + "suspendedContext appears to not exist on sender chain..." + ^ raiseContext. + ]. + nextContext canReturn ifTrue:[ + returnableContext := nextContext. + ]. + nextContext ~~ suspendedContext. + ] whileTrue. ]. ^ returnableContext ! @@ -2046,16 +2046,16 @@ "is nil a valid originator? If so, we need an extra instanceVariable to record the originator setting" originator isNil ifTrue:[ - originator := suspendedContext homeReceiver + originator := suspendedContext homeReceiver ]. signal isNil ifTrue:[ - signal := self class + signal := self class ] ifFalse:[ - signal isExceptionCreator ifFalse:[ - "not an exception or Signal - there is something wrong here..." - SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'. - ] + signal isExceptionCreator ifFalse:[ + "not an exception or Signal - there is something wrong here..." + SignalError raiseWith:signal errorString:'unexpected non-ExceptionCreator in calling context'. + ] ]. "now, start searching for a handler. @@ -2066,60 +2066,60 @@ currentContext := suspendedContext findExceptional. [currentContext notNil] whileTrue:[ - (currentContext isRaiseContext) ifTrue:[ - |ex1 con1| - - "skip all the contexts between the raise and the sender of #handle:do" - ex1 := currentContext receiver. "exception, that has been raised" - con1 := ex1 handlerContext. "the context of the #handle:do:" - - con1 isNil ifTrue:[ - "the handlerContext is nil if an exception's default action is performed. - Start search at the sending context. - 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. - - 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 caught by a default action is raised again. - don't recurse" - ^ self noHandler. - ]. - ] ifFalse:[ - "skip to the raised exception's handleContext" - currentContext := con1. - ]. - ex1 := con1 := nil. - ] ifFalse:[ "currentContext is a handleContext" - |r handler| - - "ask the the receiver of the #handle:do: or #on:do: or whatever- message for the handler. - nil is returned, if the signal is not accepted" - r := currentContext receiver. "receiver of #handle:do: or #on:do:" - (r notNil and:[(handler := r handlerForSignal:signal - context:currentContext - originator:originator) notNil] - ) ifTrue:[ - "call the handler" - - handlerContext := currentContext. - currentContext := nil. - self doCallHandler:handler. - - "if the handler rejects, we arrive here - continue search for another handler" - currentContext := handlerContext. - handler := handlerContext := nil. - ]. - r := handler := nil. - ]. - currentContext notNil ifTrue:[ - currentContext := currentContext findSpecialHandle:true raise:true. "search starts at currentContext sender" - ]. + (currentContext isRaiseContext) ifTrue:[ + |ex1 con1| + + "skip all the contexts between the raise and the sender of #handle:do" + ex1 := currentContext receiver. "exception, that has been raised" + con1 := ex1 handlerContext. "the context of the #handle:do:" + + con1 isNil ifTrue:[ + "the handlerContext is nil if an exception's default action is performed. + Start search at the sending context. + 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. + + 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 caught by a default action is raised again. + don't recurse" + ^ self noHandler. + ]. + ] ifFalse:[ + "skip to the raised exception's handleContext" + currentContext := con1. + ]. + ex1 := con1 := nil. + ] ifFalse:[ "currentContext is a handleContext" + |r handler| + + "ask the receiver of the #handle:do: or #on:do: or whatever- message for the handler. + nil is returned, if the signal is not accepted" + r := currentContext receiver. "receiver of #handle:do: or #on:do:" + (r notNil and:[(handler := r handlerForSignal:signal + context:currentContext + originator:originator) notNil] + ) ifTrue:[ + "call the handler" + + handlerContext := currentContext. + currentContext := nil. + self doCallHandler:handler. + + "if the handler rejects, we arrive here + continue search for another handler" + currentContext := handlerContext. + handler := handlerContext := nil. + ]. + r := handler := nil. + ]. + currentContext notNil ifTrue:[ + currentContext := currentContext findSpecialHandle:true raise:true. "search starts at currentContext sender" + ]. ]. "