Skip to content
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

[fetch] Failed API request breaks app #973

Closed
jbhatab opened this issue Apr 22, 2015 · 3 comments
Closed

[fetch] Failed API request breaks app #973

jbhatab opened this issue Apr 22, 2015 · 3 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@jbhatab
Copy link

jbhatab commented Apr 22, 2015

This is what happens when I make a failed api request. Are failed api requests supposed to break the app like this? Is there a good way to have a fallback?

screen shot 2015-04-22 at 4 05 37 pm

@jbhatab jbhatab changed the title Network request failed Failed API request breaks app Apr 22, 2015
@graemetait
Copy link

Can we see your code? I haven't had any problems catching errors from network problems so far.

Here's an example using fetch().

fetch('http://example.com/stuff.json')
      .then(response => response.json())
      .then(json => this._handleResponse(json))
      .catch(error => {
        React.AlertIOS.alert(
          'Error',
          'There seems to be an issue connecting to the network.'
        );
      });

@joshbedo
Copy link

Adding a catch solved this issue for me, thanks! :)

@brentvatne brentvatne changed the title Failed API request breaks app [fetch] Failed API request breaks app May 30, 2015
@brentvatne
Copy link
Collaborator

This should only happen in development mode, if you can reproduce with development mode disabled, please ping me and I'll reopen this issue! @jbhatab

@facebook facebook locked as resolved and limited conversation to collaborators May 30, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 22, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants