title: how to handle network request failed error?
body: <p><strong>my problem differs from <a href="https://stackoverflow.com/questions/38418998/react-native-fetch-network-request-failed">React Native fetch() Network Request Failed</a>, I'm not struggling with http or https, I just want to provide a nice error to the user if the request fails due to the internet connection, wrong API, etc. instead of getting react native error.</strong></p>
  
  <p>I have a form and want to send it to a server and get a response so I wrote this:</p>
  
  <pre><code>submitForm = async () =&gt; {
    fetch("www.somewhere.com", {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify(some_data)
    })
    .then((response) =&gt; response.json())
    .then((responseJson) =&gt; {
       // do something
    })
    .catch((error) =&gt; {
        this.setState({server_error: "request failed try again."});
    });
  };
  </code></pre>
  
  <p>But It seems that my catch doesn't work correctly because if the request fails I get an error from react native like this:
  <a href="https://i.stack.imgur.com/qhJIB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qhJIB.png" alt="enter image description here"></a>
  and in production, it just jumps out of the app, how can I avoid this?</p>