# HG changeset patch # User Stefan Vogel # Date 1489860176 -3600 # Node ID 1b566be1fc3f5b3629089fd94bb58d143f61d752 # Parent 03adeaeac78f14a40dcc6168d3bf2946270ff936 #REFACTORING by stefan class: GenericException changed: #doCallHandler: Use #isBlockWithArgumetCount. Redefining #argumentCount in Object and using it for exceptions is not safe! Strings redefine #argumentCount. This would not work: [1 // 0] on:ArithmeticError do:'copy:with:' diff -r 03adeaeac78f -r 1b566be1fc3f GenericException.st --- a/GenericException.st Sat Mar 18 19:00:40 2017 +0100 +++ b/GenericException.st Sat Mar 18 19:02:56 2017 +0100 @@ -2031,17 +2031,19 @@ |val| - aHandlerBlock argumentCount == 0 ifTrue:[ - "0-arg handler or any object - not interested in the exception argument" - val := aHandlerBlock value + (aHandlerBlock isBlockWithArgumentCount:1) ifTrue:[ + "1-arg handler - pass myself as exception argument" + val := aHandlerBlock value:self. ] ifFalse:[ - "1-arg handler - pass myself as exception argument" - val := aHandlerBlock value:self. + "0-arg handler or any object - not interested in the exception argument" + val := aHandlerBlock value ]. "handler fall through - is just like a #return:(aHandlerBlock value)" self return:val + + "Modified: / 18-03-2017 / 18:08:40 / stefan" ! doRaise