Skip to content

fetch does not throw error with a malformed URL #17843

@ghost

Description

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

(Write your answer here.)

Environment

Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.1
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.0.0 => 16.0.0
react-native: 0.52.0 => 0.52.0

Steps to Reproduce

(Write your steps here:)

  1. Make a fetch request to a malformed url like https://http:.malformedurl.com
  2. The error is not propagated to the promise resolvers

Expected Behavior

The error should be thrown in the Javascript so that it can be caught in the catch block

Actual Behavior

(Write what happened. Add screenshots!)

Reproducible Demo

test = async () => {
    try {
      await fetch('https://http:.malformedurl.com/.jsapi/info')
      console.log('Fetch successful')
    }
    catch(error) {
      console.error(error); // never goes here
    }
    
  }
  componentDidMount() {
    this.test();
  }
  

screenshot_1517611982

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions