Exception.st
changeset 3110 9a1e3a736e14
parent 3100 c96f3b203a60
child 3111 a23fa6d08ce7
equal deleted inserted replaced
3109:2ac640e610aa 3110:9a1e3a736e14
   765 
   765 
   766                 ex1 := c receiver.
   766                 ex1 := c receiver.
   767 
   767 
   768                 ((ex1 class == self class)
   768                 ((ex1 class == self class)
   769                 or:[ex1 species == self species]) ifTrue:[
   769                 or:[ex1 species == self species]) ifTrue:[
   770                     c := c sender.
   770 		    (ex1 signal == theSignal) ifTrue:[
   771                     (c notNil and:[c receiver == ex1]) ifTrue:[
   771                         h := ex1 handlerContext.
   772                         c := c sender.
   772                         h notNil ifTrue:[
   773                         c notNil ifTrue:[
   773                             r := h receiver.
   774 
   774                             (r notNil and:[r accepts:theSignal]) ifTrue:[
   775                             "/ the common case (really ?) first
   775                                 activeHandlers isNil ifTrue:[
   776                             ((raiseReceiver := c receiver) == theSignal) ifTrue:[
   776                                     activeHandlers := OrderedCollection new
   777                                 (c selector startsWith:'raise') ifTrue:[
   777                                 ].
   778                                     h := ex1 handlerContext.
   778 
   779                                     h notNil ifTrue:[
   779                                 lastHandler := h.
   780                                         activeHandlers isNil ifTrue:[
   780                                 activeHandlers add:lastHandler.
   781                                             activeHandlers := OrderedCollection new
   781                                 inHandler := true.
   782                                         ].
   782                                 c := lastHandler.
   783 
       
   784                                         lastHandler := h.
       
   785                                         activeHandlers add:lastHandler.
       
   786                                         inHandler := true.
       
   787                                         c := lastHandler.
       
   788                                     ]
       
   789                                 ]
       
   790                             ] ifFalse:[
       
   791                                 raiseReceiver isSignal ifTrue:[
       
   792                                     (c selector startsWith:'raise') ifTrue:[
       
   793                                         h := ex1 handlerContext.
       
   794                                         h notNil ifTrue:[
       
   795                                             r := h receiver.
       
   796                                             (r notNil and:[r accepts:theSignal]) ifTrue:[
       
   797 
       
   798                                                 activeHandlers isNil ifTrue:[
       
   799                                                     activeHandlers := OrderedCollection new
       
   800                                                 ].
       
   801                                                 lastHandler := h.
       
   802                                                 activeHandlers add:lastHandler.
       
   803                                                 inHandler := true.
       
   804                                                 c := lastHandler.
       
   805                                             ]
       
   806                                         ]    
       
   807                                     ]    
       
   808                                 ]    
       
   809                             ]
   783                             ]
   810                         ]
   784                         ]
   811                     ]
   785                     ]
   812                 ]
   786                 ]
   813             ] ifFalse:[
   787             ] ifFalse:[
   887 
   861 
   888         "/
   862         "/
   889         "/ if it is not the NoHandlerSignal, raise it ...
   863         "/ if it is not the NoHandlerSignal, raise it ...
   890         "/ passing the receiver as parameter.
   864         "/ passing the receiver as parameter.
   891         "/
   865         "/
       
   866 'a' printCR.
   892         signal ~~ (noHandlerSignal := Signal noHandlerSignal) ifTrue:[
   867         signal ~~ (noHandlerSignal := Signal noHandlerSignal) ifTrue:[
   893             noHandlerSignal notNil ifTrue:[
   868             noHandlerSignal notNil ifTrue:[
   894                 any ifTrue:[
   869                 any ifTrue:[
   895                     msg := 'unhandled (rejected)'
   870                     msg := 'unhandled (rejected)'
   896                 ] ifFalse:[
   871                 ] ifFalse:[
   897                     msg := 'unhandled'
   872                     msg := 'unhandled'
   898                 ].
   873                 ].
   899                 msg := msg , ' exception: (' , errorString , ')'.
   874                 msg := msg , ' exception: (' , errorString , ')'.
       
   875 'b' printCR.
   900                 ^ noHandlerSignal 
   876                 ^ noHandlerSignal 
   901                       raiseRequestWith:self 
   877                       raiseRequestWith:self 
   902                            errorString:msg
   878                            errorString:msg
   903                                     in:self suspendedContext
   879                                     in:self suspendedContext
   904             ].
   880             ].
   968 ! !
   944 ! !
   969 
   945 
   970 !Exception class methodsFor:'documentation'!
   946 !Exception class methodsFor:'documentation'!
   971 
   947 
   972 version
   948 version
   973     ^ '$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.60 1997-11-11 14:39:26 cg Exp $'
   949     ^ '$Header: /cvs/stx/stx/libbasic/Exception.st,v 1.61 1997-11-14 15:20:03 cg Exp $'
   974 ! !
   950 ! !
   975 Exception initialize!
   951 Exception initialize!