title: Return Promise.Reject() in Fetch
body: <p>I'm building an App with React and what I want to do is to return a fetch as  rejected Promise if certain conditions happen. This is (part of) my code:</p>
  
  <pre><code>return (fetch(controllerURI, {
          method: 'post',
          headers: { 'Content-Type': 'application/json; charset=utf-8' },
          body: JSON.stringify({
              "userId": this.state.userEmailAndName.userId,
              "name": this.state.userEmailAndName.name,
              "newEmail": this.state.userEmailAndName.newEmail
          })
      })
          .then(response =&gt; response.json()).then(data =&gt; {
              if (data.code == "ER")
                  Throw new Error("ERROR");
      })
          .catch(e =&gt; {
              console.log("Inside catch");
              // This catch caught the Throw Error in .then().
      })
  );
  </code></pre>
  
  <p>So, basically, if 'data.code' is equal to "ER" (Error), I want the fetch to be evaluated as reject.</p>
  
  <p>In some other point of the Application, I've a Promise.All that calls the method in which there is the return fetch I've just written.</p>
  
  <pre><code>let fetch1 = this.handleEmailAndNameSubmit(undefined, true);
  let fetch2 = this.handlePasswordSubmit(undefined, true);
  
  Promise.all([fetch1, fetch2]).then(() =&gt; {
      (this.state.lastLinkClicked).click();
  }));
  </code></pre>
  
  <p><strong>EDIT:</strong> First problem was result (or at least, the reason why it happened).. </p>
  
  <p>Having the catch statement, the 'Throw new Error' is caught by it, and the Promise.all can enter its .then().. But I would like to keep that catch statement because, if the fetch would fail for any reason that are not connected to the data.code (like impossibility to connect to the URI), I need to catch the problem and display a proper message.</p>