title: HTTP request error code 429 cannot be caught
body: <p>Using <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API" rel="nofollow noreferrer">fetchApi</a> I am issuing a POST request to an endpoint and catching errors like this:</p>
  
  <pre><code>fetch(new Request(url, {
    method: 'POST',
    headers: { ...defaultHeaders, ...headers } ,
    credentials: 'include',
    body: JSON.stringify(body)
  })).then(
    // handle correct reponse
  ).catch(
    if (err.status === 401) {
         // handle error nicely
      } else if (err.status === 429) {
         // handle error differently
      } else {
        // handle error yet another way
      }
  );
  </code></pre>
  
  <p>While 401 error is handled as expected, when the endpoint responds with 429 the code</p>
  
  <pre><code>else if (err.status === 429) {
         // handle error differently
      } 
  </code></pre>
  
  <p>Is never executed.</p>
  
  <p>EDIT1: the entire catch is never reached in case of 429</p>
  
  <p><strong>Are 401 and 429 status codes handled differently by javascript/browsers?</strong>
  <strong>How Can I catch 429 error and handle it my way?</strong></p>