title: Stop Promise Chain execution in a recommended way
body: <p>I have a code similar to this one :</p>
  
  <pre><code>promise_function().then(()=&gt;{
    //do something
    return another_promise_fucntion();
  }).then(() =&gt; {
    //do something
    return another_promise_function1();
  }).then((result) =&gt; {
    //check if result is valid
    if(!result)
       //break chain (how to stop calling the next .then functions ?)
    else
       return another_promise_function2();
  }).then(()=&gt;{
     //do something
     return another_promise_function3();
  }).catch((err)=&gt;{
     //handle error
  });
  </code></pre>
  
  <p>I want to stop calling the next .then() functions, if the returned result is not valid. </p>
  
  <p>I used "throw new Error()", and it worked just fine, but I am not sure if it is the recommended way.</p>