extensions.st
changeset 19203 456663c8a476
parent 19201 f0388a240865
child 19227 962f6c37ad81
--- a/extensions.st	Thu Sep 19 15:14:50 2019 +0200
+++ b/extensions.st	Thu Sep 19 21:30:50 2019 +0200
@@ -2402,20 +2402,29 @@
 inspector2TabJSON
     <inspector2Tab>
 
-    |jsonPrinter jsonString|
+    |jsonPrinter jsonString countRecursive|
 
     (jsonPrinter := Smalltalk classNamed:'JSONPrinter') isNil ifTrue:[^ nil].
 
+    countRecursive := 0.
     [
         jsonString := jsonPrinter encodePrettyPrinted:self.
     ] on:Error do:[:ex |
+        (ex isKindOf:RecursionError) ifTrue:[
+            ex originator == JSONPrinter ifTrue:[
+                countRecursive := countRecursive + 1.
+                countRecursive < 10 ifTrue:[
+                    ex proceed.
+                ].
+            ].
+        ].
         jsonString := '%1\(an instance of %2)\cannot be represented as JSON because:\\%3' withCRs
                         bindWith:self displayString
                         with:self class className
                         with:ex description
     ].
 
-    ^self newInspector2Tab
+    ^ self newInspector2Tab
         label: 'JSON';
         priority: 15;
         view: ((HVScrollableView for:TextView)