Search in sources :

Example 1 with DiagnosticLevel

use of io.flutter.inspector.DiagnosticLevel in project flutter-intellij by flutter.

the class FlutterConsoleLogManager method processFlutterErrorEvent.

/**
 * Pretty print the error using the available console syling attributes.
 */
private void processFlutterErrorEvent(@NotNull DiagnosticsNode diagnosticsNode) {
    final String description = " " + diagnosticsNode.toString() + " ";
    final boolean terseError = !isFirstErrorForFrame() && !FlutterSettings.getInstance().isIncludeAllStackTraces();
    frameErrorCount++;
    final String prefix = "========";
    final String suffix = "==";
    console.print("\n" + prefix, TITLE_CONTENT_TYPE);
    console.print(description, NORMAL_CONTENT_TYPE);
    console.print(StringUtil.repeat(errorSeparatorChar, Math.max(errorSeparatorLength - prefix.length() - description.length() - suffix.length(), 0)), TITLE_CONTENT_TYPE);
    console.print(suffix + "\n", TITLE_CONTENT_TYPE);
    if (terseError) {
        for (DiagnosticsNode property : diagnosticsNode.getInlineProperties()) {
            printTerseNodeProperty(console, "", property);
        }
    } else {
        DiagnosticLevel lastLevel = null;
        String errorSummary = null;
        for (DiagnosticsNode property : diagnosticsNode.getInlineProperties()) {
            // Add blank line between hint and non-hint properties.
            if (lastLevel != property.getLevel()) {
                if (lastLevel == DiagnosticLevel.hint || property.getLevel() == DiagnosticLevel.hint) {
                    console.print("\n", NORMAL_CONTENT_TYPE);
                }
            }
            lastLevel = property.getLevel();
            if (StringUtil.equals("ErrorSummary", property.getType())) {
                errorSummary = property.getDescription();
            } else if (StringUtil.equals("DevToolsDeepLinkProperty", property.getType()) && FlutterSettings.getInstance().isEnableEmbeddedBrowsers() && JxBrowserManager.getInstance().getStatus().equals(JxBrowserStatus.INSTALLED)) {
                showDeepLinkNotification(property, errorSummary);
                continue;
            }
            printDiagnosticsNodeProperty(console, "", property, null, false);
        }
    }
    console.print(StringUtil.repeat(errorSeparatorChar, errorSeparatorLength) + "\n", TITLE_CONTENT_TYPE);
}
Also used : DiagnosticLevel(io.flutter.inspector.DiagnosticLevel) DiagnosticsNode(io.flutter.inspector.DiagnosticsNode)

Aggregations

DiagnosticLevel (io.flutter.inspector.DiagnosticLevel)1 DiagnosticsNode (io.flutter.inspector.DiagnosticsNode)1