#REFACTORING by stefan
authorStefan Vogel <sv@exept.de>
Sat, 18 Mar 2017 19:02:56 +0100
changeset 21663 1b566be1fc3f
parent 21662 03adeaeac78f
child 21664 ac3e93c147b3
#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:'
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