-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: PlatformDispatcher.onError integration #915
Feature: PlatformDispatcher.onError integration #915
Conversation
Not sure why the tests fail on the beta channel. The type errors which are shown are just wrong: https://github.com/flutter/engine/blob/28a5d3c05d61b25f82080260bae4b6c3b77d03b5/lib/ui/platform_dispatcher.dart#L64 Edit: Web has a different signature: https://github.com/flutter/engine/blob/28a5d3c05d61b25f82080260bae4b6c3b77d03b5/lib/web_ui/lib/platform_dispatcher.dart#L17 Edit 2: I guess the tests have to be disabled until flutter/engine#34428 hits the beta/stable channel or this should only be merged when the fixed error handler hits the beta/stable channel. Edit 3: Fix has landed Edit 4: Latest Flutter beta includes the fix, so this is ready |
@ueman Right now the |
Sounds reasonable, since it's only available in the beta anyway. The FlutterErrorIntegration and this one play nicely together. The IsolateIntegration probably too. Just the RunZoneGuardedIntegration will become obsolete. That's however quite nice, because it enables us (speaking as a user) to be much more flexible in enabling and disabling Sentry. That's important for GDPR, for example. The goal is to use this integration when available and the RunZoneGuardedIntegration on older Flutter versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ueman
📜 Description
This adds an integration for
PlatformDispatcher.onError
which was introduced in the Flutter 3.1 beta.The interesting thing about the addition of this error handler is that the
runZonedGuarded
integration isn't needed anymore. This needs some more testing, though.Ideally, the
runZonedGuarded
integration shouldn't be applied anymore if thePlatformDispatcher.onError
is available. The removal ofrunZonedGuarded
also removes the ability to logprint()
statements. In Flutter that's not that bad, as Flutter usesdebugPrint()
which is still logged as breadcrumbs.This could also replace the
IsolateErrorIntegration
(at least on Flutter), but that needs to be tested, too.The removal of the
runZonedGuarded
integration leads to much less complicated manual initialization code, because Sentry can now be initialized anywhere in the application lifecycle. There's no need anymore for Sentry to be the first call the user does in his code.This is especially important for the use case, where crash reporting should only be enabled after user consent.
Example event: https://sentry.io/organizations/sentry-sdks/issues/3229407573/events/c912a632f2b147099657544fa4f22c60/?project=5428562
The error handler was introduced in flutter/engine#32078
💡 Motivation and Context
Closes #833
💚 How did you test it?
New test + example application
Test scenarios
runZoneGuarded
integration and throw and uncaught exception📝 Checklist
🔮 Next steps
runZoneGuarded
integration if this error handler is available.