From bcd5a3d21f45c1b834982cbaf1279122543dc120 Mon Sep 17 00:00:00 2001 From: Devon Carew Date: Sun, 20 Sep 2020 12:02:40 -0700 Subject: [PATCH] only send analytics for the first error for a frame --- .../flutter/logging/FlutterConsoleLogManager.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/io/flutter/logging/FlutterConsoleLogManager.java b/src/io/flutter/logging/FlutterConsoleLogManager.java index a64cc57f42..77a5b5015c 100644 --- a/src/io/flutter/logging/FlutterConsoleLogManager.java +++ b/src/io/flutter/logging/FlutterConsoleLogManager.java @@ -130,9 +130,11 @@ public void handleFlutterErrorEvent(@NotNull Event event) { final DiagnosticsNode diagnosticsNode = new DiagnosticsNode(jsonObject, objectGroup, app, false, null); // Send analytics for the diagnosticsNode. - final String errorId = FlutterErrorHelper.getAnalyticsId(diagnosticsNode); - if (errorId != null) { - FlutterInitializer.getAnalytics().sendEvent("flutter-error", errorId); + if (isFirstErrorForFrame()) { + final String errorId = FlutterErrorHelper.getAnalyticsId(diagnosticsNode); + if (errorId != null) { + FlutterInitializer.getAnalytics().sendEvent("flutter-error", errorId); + } } if (FlutterSettings.getInstance().isShowStructuredErrors()) { @@ -164,7 +166,7 @@ private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode) frameErrorCount++; - final boolean terseError = frameErrorCount > 1; + final boolean terseError = !isFirstErrorForFrame(); final String prefix = "════════"; final String suffix = "══"; @@ -204,6 +206,10 @@ private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode) console.print(StringUtil.repeat(errorSeparatorChar, errorSeparatorLength) + "\n", TITLE_CONTENT_TYPE); } + private boolean isFirstErrorForFrame() { + return frameErrorCount == 0; + } + private void printTerseNodeProperty(ConsoleView console, String indent, DiagnosticsNode property) { boolean skip = true;