Skip to content

Commit 5d70057

Browse files
authored
only send analytics for the first error for a frame (#4867)
1 parent 947457e commit 5d70057

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/io/flutter/logging/FlutterConsoleLogManager.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ public void handleFlutterErrorEvent(@NotNull Event event) {
130130
final DiagnosticsNode diagnosticsNode = new DiagnosticsNode(jsonObject, objectGroup, app, false, null);
131131

132132
// Send analytics for the diagnosticsNode.
133-
final String errorId = FlutterErrorHelper.getAnalyticsId(diagnosticsNode);
134-
if (errorId != null) {
135-
FlutterInitializer.getAnalytics().sendEvent("flutter-error", errorId);
133+
if (isFirstErrorForFrame()) {
134+
final String errorId = FlutterErrorHelper.getAnalyticsId(diagnosticsNode);
135+
if (errorId != null) {
136+
FlutterInitializer.getAnalytics().sendEvent("flutter-error", errorId);
137+
}
136138
}
137139

138140
if (FlutterSettings.getInstance().isShowStructuredErrors()) {
@@ -164,7 +166,7 @@ private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode)
164166

165167
frameErrorCount++;
166168

167-
final boolean terseError = frameErrorCount > 1;
169+
final boolean terseError = !isFirstErrorForFrame();
168170

169171
final String prefix = "════════";
170172
final String suffix = "══";
@@ -204,6 +206,10 @@ private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode)
204206
console.print(StringUtil.repeat(errorSeparatorChar, errorSeparatorLength) + "\n", TITLE_CONTENT_TYPE);
205207
}
206208

209+
private boolean isFirstErrorForFrame() {
210+
return frameErrorCount == 0;
211+
}
212+
207213
private void printTerseNodeProperty(ConsoleView console, String indent, DiagnosticsNode property) {
208214
boolean skip = true;
209215

0 commit comments

Comments
 (0)