Skip to content

Better error messages from image component #33034

@frags51

Description

@frags51

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions