title: How handle Fetch failures in Redux's action creators
body: <p>Redux docs suggest to  have 3 different actions per AJAX request. For example for Login they would be: </p>
  
  <ul>
  <li><code>LOGIN_REUQEST</code></li>
  <li><code>LOGIN_FAILURE</code></li>
  <li><code>LOGIN_SUCCESS</code></li>
  </ul>
  
  <p>But I have problem with catching all errors that can be thrown by <code>fetch</code>.
  In redux docs I found this example: </p>
  
  <pre><code>return fetch(`https://www.reddit.com/r/${subreddit}.json`)
    .then(
      response =&gt; response.json(),
      // Do not use catch, because that will also catch
      // any errors in the dispatch and resulting render,
      // causing an loop of 'Unexpected batch number' errors.
      // https://github.com/facebook/react/issues/6895
      error =&gt; console.log('An error occured.', error)
    )
    .then(json =&gt;
      // We can dispatch many times!
      // Here, we update the app state with the results of the API call.
  
      dispatch(receivePosts(subreddit, json))
    )
  </code></pre>
  
  <p>}</p>
  
  <p>But I see several problems in it: </p>
  
  <ol>
  <li>It doesn't use catch, so it wont catch any problems with AJAX request on user side (for example no internet)</li>
  <li>It doesn't handle responses with status != 200. </li>
  </ol>
  
  <p>I ended up this this code, but still it won't handle case #1 (because of React issue - see comment in above code):</p>
  
  <pre><code> fetch('/api/auth/signin', {...}),
          headers: {
              'Content-Type': 'application/json',
              'Accept': 'application/json, text/plain, */*',
          }
      })
      .then ( response =&gt;
          response.json().then(json =&gt; {
              if (response.ok) {
                  dispatch(loginSuccess(json))
              } else {
                  dispatch(loginFailure(json.errMsg))
              }
          })
       )
  </code></pre>
  
  <p>Can you please give me any example which handles all possible errors with AJAX request using fetch. Many tutorial and open-source projects just ignoring it. </p>