Skip to content
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

Better error messages from image component #33034

Closed
frags51 opened this issue Feb 3, 2022 · 3 comments
Closed

Better error messages from image component #33034

frags51 opened this issue Feb 3, 2022 · 3 comments
Labels
Component: Image Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@frags51
Copy link

frags51 commented Feb 3, 2022

Description

Using RN 0.64.2.
Right now, the error messages from the image component are not at all helpful. For e.g., in onError we just get errors like "Image failed to load" which does not help in debugging. It would be great if we can get details like response body/headers in case of network call, and other descriptive messages like "Internet connection not available" etc.

Version

0.64.3

Output of npx react-native info

System:
OS: Windows 10 10.0.19044
CPU: (12) x64 Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz
Memory: 39.28 GB / 63.59 GB
Binaries:
Node: 12.22.1 - ~\AppData\Local\nvs\default\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.12 - ~\AppData\Local\nvs\default\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 4.0.0.0 AI-193.6911.18.40.6821437
Visual Studio: 15.9.28307.1759 (Visual Studio Enterprise 2017), 16.7.32002.127 (Visual Studio Enterprise 2019)
Languages:
Java: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.3 => 0.64.3
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

Just render any image that fails to load for some reason.
<Image source={{uri: 'https://foo.bar/needsAuthHeadersButNoneSupplied'}} />
<Image source={{uri: 'https://foo.bar/image.png'}} />, but internet is not connected

Snack, code example, screenshot, or link to a repository

No response

@frags51
Copy link
Author

frags51 commented May 10, 2022

Any updates on this issue?

facebook-github-bot pushed a commit that referenced this issue Jun 10, 2022
Summary:
Please see this issue #33034 for details on the problem solved by this PR.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[CATEGORY] [TYPE] - Message
[ios] [changed] - HTTP Response headers added to the error object passed to JS code.

Pull Request resolved: #33880

Test Plan:
Tested:
(All tests done on images in rn-tester app, which is a part of this repo)
1. onError method in case image has an HTTP Error
2. onError method in case of non http error (DNS error)
3. Successful image load

Reviewed By: cortinico

Differential Revision: D37066159

Pulled By: cipolleschi

fbshipit-source-id: 546f7678fa0321fe6c6fbef55288715cb6ddc2fd
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 8, 2022
@cortinico
Copy link
Contributor

Closing as stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Image Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants