-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
cannot catch error from fetch call when used a malformed URL #18087
Comments
fetch has been having this very bad problem for some time now, crashing apps in production whenever something it doesn't like happen. At this point, I'm looking for good alternatives :-( |
Check if url is good and returns something. Send an request at that link with postman check what it returns. |
@Dorentin1997 thank you for your comment. |
Use url-parse do the logic there, if it`s wrong throw the exception there. |
@Dorentin1997 again. Yes as a workaround. |
@Trenrod Yes it`s clearly a bug, i had problems too with this. Hopefully it will be fixed. |
…lid URL on Android Currently if you invoke `fetch()` with an invalid URL ("aaa" for example) you cannot catch the error in javascript since it's not reported. Instead the entire app crashes. Fixes facebook#7436 and facebook#18087 Hopefully.
…lid URL on Android Summary: Currently if you invoke `fetch()` with an invalid URL ("aaa" for example) you cannot catch the error in javascript since it's not reported. Instead the entire app crashes. Fixes #7436 and #18087 Hopefully. <!-- Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html Happy contributing! --> Fix using fetch on Android with user generated input. Added relevant unit test `./scripts/run-android-local-unit-tests.sh` all pass [ANDROID] [BUGFIX] [fetch] - Allow "unexpected url" exception to be caught on Android when using fetch <!-- Help reviewers and the release process by writing your own release notes **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [-{Component}-] [ INTERNAL ] [ ENHANCEMENT ] [ {File} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| [CATEGORY] [TYPE] [LOCATION] - MESSAGE EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes #18103 Differential Revision: D7097110 Pulled By: hramos fbshipit-source-id: 69144e8a0f7404d9bcc7c71a94650de36a48c84a
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions. |
This issue has been inactive for a very long time, closing. There are newer and more active issues on this subject. |
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment:
OS: Windows 10
Node: 6.12.3
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.0.0.0 AI-171.4443003
Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.3 => 0.53.3
Target Platform: Android 6 Emulator (From the Getting Started howto)
Steps to Reproduce
Cannot catch the fetch call when used a malformed url.
Expected Behavior
catch should be executed
Actual Behavior
red screen shows up with "unexpected url: [URL USED WITHIN THE CALL]"
Reproducible Demo
Actual console output is:
DEBUG - START FETCHING
Note: Same issue like #17843
The text was updated successfully, but these errors were encountered: