FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Bugfix: Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing by robert-northmind · Pull Request #937 · Baseflow/flutter_cached_network_image · GitHub

Repository navigation

Bugfix: Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing - #937

Merged
martijn00 merged 1 commit into
Baseflow:developfrom
robert-northmind:bugfix/emit_error_via_stream_in_ImageLoader
Jul 31, 2024
Merged

martijn00 merged 1 commit into
Baseflow:developfrom
robert-northmind:bugfix/emit_error_via_stream_in_ImageLoader

Conversation

robert-northmind commented Apr 10, 2024 •
edited
Loading

Copy link
Copy Markdown
Contributor

✨ What kind of change does this PR introduce? (Bug fix, feature, docs update...)

This is a bug fix

⤵️ What is the current behavior?

If the CachedNetworkImageProvider gets some error when fetching an image url, then internally the ImageLoader will rethrow that error.
This leads to the unwanted behavior that you get an uncaught exception.
And this for example then leads to faulty fatal errors being reported in Crashlytics.

🆕 What is the new behavior (if this is a feature change)?

Instead of throwing the error inside the ImageLoader, we are now emitting the error as a stream error into the current stream.
This has the added benefit that this will not be an uncaught exception.
And all existing ErrorListeners, ErrorBuilders will still work.

💥 Does this PR introduce a breaking change?

No

🐛 Recommendations for testing

You can test this change with the existing example app.
If you run the example app for a mobile device and enabled the debugger to catch uncaught exceptions, then with this fix you will not get any uncaught exceptions. And before this fix, you would get uncaught exceptions for the https://notAvalid.uri and the not a uri at all.

📝 Links to relevant issues/docs

N/A

🤔 Checklist before submitting

  • All projects build
  • Follows style guide lines (code style guide)
  • Relevant documentation was updated
  • Rebased onto current develop

Screenshots

These screenshots come from VSCode running the previous version with uncaught exceptions turned on:

And here is a screenshot coming from this version with uncaught exceptions turned on:

robert-northmind changed the title Change how errors are reported by ImageLoader. Emits as stream instea… Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing Apr 10, 2024
robert-northmind changed the title Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing Bugfix: Change how errors are reported by ImageLoader. Emits as stream instead of re-throwing Apr 10, 2024
child: BlurHash(hash: 'LEHV6nWB2yk8pyo0adR*.7kCMdnj'),
),
imageUrl: 'https://blurha.sh/assets/images/img1.jpg',
imageUrl: 'https://blurha.sh/12c2aca29ea896a628be.jpg',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I just updated this URL since the old https://blurha.sh/assets/images/img1.jpg didn't point to a resource anymore. You just got back a 404.

martijn00 merged commit a05e39d into Baseflow:develop Jul 31, 2024
robert-northmind deleted the bugfix/emit_error_via_stream_in_ImageLoader branch August 1, 2024 08:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL