recordFlutterFrameworkError method

  1. @visibleForTesting
void recordFlutterFrameworkError(
  1. FlutterErrorDetails details, {
  2. String? source,
})

Implementation

@visibleForTesting
void recordFlutterFrameworkError(
  FlutterErrorDetails details, {
  String? source,
}) {
  final exceptionMessage = details.exceptionAsString();
  final library = details.library;
  _recordCritical(
    CockpitRuntimeEvent(
      eventId: _nextEventId(),
      kind: CockpitRuntimeEventKind.flutterError,
      severity: CockpitRuntimeEventSeverity.error,
      message: _truncate(exceptionMessage, maxMessageLength),
      recordedAt: DateTime.now().toUtc(),
      routeName: _routeNameProvider(),
      source: source ?? library ?? 'FlutterError.onError',
      details: _boundedDetails(<String, String>{
        if (library != null && library.isNotEmpty) 'library': library,
        if (details.context != null) 'context': '${details.context}',
      }),
      stackTracePreview: details.stack == null
          ? null
          : _formatStackTrace(details.stack!),
      stackTraceTruncated: details.stack == null
          ? false
          : _stackTraceWasTruncated(details.stack!),
    ),
  );
}