-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Description
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.
- Call fetch() with a malformed url like 'asd' or 'https:://facebook.github.io'
- try to catch with '.catch' when called as promise or try/catch within async/await
Expected Behavior
catch should be executed
Actual Behavior
red screen shows up with "unexpected url: [URL USED WITHIN THE CALL]"
Reproducible Demo
async asyncFetch(url) {
try {
console.log('DEBUG - START FETCHING');
const response = await fetch(url);
console.log('DEBUG - END FETCHING');
const xml = await response.text();
const json = xml2json.parse(xml);
return { data: json };
} catch (error) {
console.log('DEBUG - START ERROR: ' + error.message);
throw error;
}
}
const url = 'httasd:afdasdfads';
this.asyncFetch(url)
.catch(err => {
console.log('DEBUG - Error: ' + err.message);
})
Actual console output is:
DEBUG - START FETCHING
Note: Same issue like #17843
ksegla, jcurtis and SPATAN18
Metadata
Metadata
Assignees
Labels
Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.