What happens if you don't resolve or reject a promise?
<p>I have a scenario where I am returning a promise.
The promise is basically triggered by an ajax request.</p>

<p>On rejecting the promise it shows an error dialog that there is a server error.</p>

<p>What I want to do is when the response code is 401, I neither want to resolve the promise nor reject it (because it already shows the error dialog). I want to simply redirect to the login page.</p>

<p>My code looks something like this:</p>

<pre><code>function makeRequest(ur, params) {
  return new Promise(function (resolve, reject) {
    fetch(url, params).then((response) =&gt; {
      let status = response.status;    
      if (status &gt;= 200 &amp;&amp; status &lt; 300) {
        response.json().then((data) =&gt; {
          resolve(data);
        });
      } else {
        if (status === 401) {
          redirectToLoginPage();
        } else {
          response.json().then((error) =&gt; {
            if (!error.message) {
              error.message = constants.SERVER_ERROR;
            }
            reject({ status, error });
          });
        }
      }
    });
  });
}
</code></pre>

<p>As you can see, if the status is 401, I am redirecting to the login page. The promise is neither resolved nor rejected.</p>

<p>Is this code OK, or is there any better way to accomplish this?</p>