-
-
Notifications
You must be signed in to change notification settings - Fork 280
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
feat: Better support error when saving the picture locally #4305
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #4305 +/- ##
===========================================
- Coverage 10.80% 10.79% -0.01%
===========================================
Files 287 287
Lines 14202 14208 +6
===========================================
Hits 1534 1534
- Misses 12668 12674 +6
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
@g123k Interesting bug! Are you able to reproduce it?
I have no idea if an isolate
is more likely to fail than a standard async
. Perhaps more memory intensive?
What about
- trying to use an
isolate
to save the picture (cf. the previous code and your PR) - if it failed, trying to use a "normal
async
" to save the picture: as a fallback, the picture is going to be saved but with a little screen freeze - which is more acceptable for the user than an enigmatic dialog - if it failed too, display an enigmatic dialog (cf. your PR)
Doing so, we'll deliver a better service to the user, while tracking and being able to understand how isolates (or async) may fail regarding saving a picture.
What do you think of that?
My guess on this is sometimes Isolate doesn't start. I'm not sure if it's worth the case to implement a better fix for now, as I can't reproduce it. |
Makes sense.
I have nothing against this idea, but I don't know how clever we are to detect it. Let me rephrase: in your PR you added a call to Sentry, but Sentry is flooded by tons of error messages. => Could you share a Sentry link (or set up a Sentry alarm if that exists) about all the time this specific error is sent to Sentry?
I'll implement "my" solution in another PR - I've just assigned myself to the issue and made sure that when this PR is merged the issue won't be closed automatically. |
FYI I've lost my access to Sentry. Once I have it back, it will share the link |
For Sentry; you just have to enter the method's name to filter all exceptions: https://openfoodfacts.sentry.io/issues/?project=5376745&query=is%3Aunresolved+_getCroppedImageFile&referrer=issue-list&statsPeriod=1h |
I will change a bit the implementation to show a dialog with an error message |
That should be better now, with a dedicated message: ErrorDialog.webm 🎬. |
…version…", we will now send the error to the server
…the image processing
84776aa
to
8943f15
Compare
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.
Hi @g123k!
Please have a look at my comments.
void _showErrorDialog() { | ||
final AppLocalizations appLocalizations = AppLocalizations.of(context); | ||
|
||
showDialog<void>( |
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.
await
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.
Mmm that's meaningless here, as we're not statement after.
Why would it be necessary?
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.
I'm not sure if it's "necessary", but it would be cleaner and more consistent with the rest of the showDialog
calls in the app.
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.
I've added a Future
to the method, which should be better
You can test this PR on: https://app.waldo.com/applications/app-19d476740ba1bb36/sessions |
Hi everyone,
If something fails in the photo-taking process, there is no error catching.
I will now catch the error and also provide a timeout, where sometimes the Isolate has weird behaviors.
We also have a dedicated method to send custom exceptions to Sentry to better track this kind of issue.
Related issue: #4304