captureException method

  1. @override
Future<void> captureException({
  1. required Object error,
  2. StackTrace? stackTrace,
  3. Map<String, Object>? properties,
})

Implementation

@override
Future<void> captureException({
  required Object error,
  StackTrace? stackTrace,
  Map<String, Object>? properties,
}) async {
  try {
    final exceptionData = DartExceptionProcessor.processException(
      error: error,
      stackTrace: stackTrace,
      properties: properties,
      inAppIncludes: _config?.errorTrackingConfig.inAppIncludes,
      inAppExcludes: _config?.errorTrackingConfig.inAppExcludes,
      inAppByDefault: _config?.errorTrackingConfig.inAppByDefault ?? true,
    );

    final exceptionProperties = _withWebContext(
      Map<String, Object>.from(exceptionData),
    );

    return await _order.event(
      () => _runBeforeSend(
        PostHogEventName.exception,
        exceptionProperties,
      ),
      (processedEvent) => _sendException(error, processedEvent),
    );
  } catch (error) {
    printIfDebug('Exception in captureException: $error');
  }
}