showWhereWeCameFrom moved
authorClaus Gittinger <cg@exept.de>
Fri, 16 Jan 2009 14:06:57 +0100
changeset 11473 4f7cef3800cf
parent 11472 d30ca682c65f
child 11474 f4c8118aab2c
showWhereWeCameFrom moved
Context.st
--- a/Context.st	Fri Jan 16 14:06:30 2009 +0100
+++ b/Context.st	Fri Jan 16 14:06:57 2009 +0100
@@ -213,6 +213,28 @@
     "Created: 6.5.1996 / 16:46:32 / cg"
 ! !
 
+!Context class methodsFor:'error handling'!
+
+showWhereWeCameFrom
+    "show the stack backtrace: at least 4 levels, or until the first 
+     send to a non-collection object (because we want to know,
+     which non-collection send invoked a bad collection-method)."
+
+    |con count|
+
+    con := thisContext sender sender.
+    count := 0.
+    [
+        ('    from ' , con printString) errorPrintCR.
+        con := con sender.
+        count := count + 1.
+    ] doWhile:[con notNil and:[count < 4 or:[con receiver isCollection]]].
+
+    "
+      #() asSet add:nil
+    "
+! !
+
 !Context class methodsFor:'queries'!
 
 isBuiltInClass
@@ -2272,7 +2294,7 @@
 !Context class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.144 2008-11-11 21:30:16 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Context.st,v 1.145 2009-01-16 13:06:57 cg Exp $'
 ! !
 
 Context initialize!