Issue
Our application is developed using Flutter, and we've noticed that the crash-free rate is significantly lower compared to Google Play. According to the documentation, a crash is defined as an explicit unhandled error or a hard crash. However, we've observed that some unhandled errors do not result in a crash within a Flutter app.
We are curious if there is a way to prevent these errors (which are not hard crashes) from affecting the crash-free rate. This would greatly assist us in accurately determining our alert thresholds.
Applies To
- All SaaS Customers and Self-Hosted Users
- Release Health
- Flutter SDK
Resolution
You have 2 options for what you want to do:
Use try/catch blocks
Any error caught in try/catch blocks is automatically considered handled by your code. All you need to do is pass the error to a Sentry.captureException
. Here is an example.
Use beforeSend
This function is where the error event goes right before it is sent to Sentry. It allows you to access the event and modify its information, so you could change its unhandled
values to handled
. You can see how this function works here.