From c1bb00f9a9935da3f990e1bbef4469c6bfe843f2 Mon Sep 17 00:00:00 2001 From: maBarabas <69897582+maBarabas@users.noreply.github.com> Date: Tue, 31 Jan 2023 13:44:56 +0000 Subject: [PATCH] Log errors from PlatformDispatcher (#1257) Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com> Fixes https://github.com/getsentry/sentry-dart/issues/1255 --- flutter/lib/src/integrations/on_error_integration.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/flutter/lib/src/integrations/on_error_integration.dart b/flutter/lib/src/integrations/on_error_integration.dart index 24795fa219..2e0db41b06 100644 --- a/flutter/lib/src/integrations/on_error_integration.dart +++ b/flutter/lib/src/integrations/on_error_integration.dart @@ -41,6 +41,14 @@ class OnErrorIntegration implements Integration { _defaultOnError = wrapper.onError; _integrationOnError = (Object exception, StackTrace stackTrace) { + _options!.logger( + SentryLevel.error, + "Uncaught Platform Error", + logger: 'sentry.platformError', + exception: exception, + stackTrace: stackTrace, + ); + final handled = _defaultOnError?.call(exception, stackTrace) ?? true; // As per docs, the app might crash on some platforms