title: Return from function on promise rejection
body: <p>I have two functions. One called something, and another that gets called from it, asyncfunc. My issue is that if inside the asyncfunc, function an error gets thrown I want to stop executing the rest of the function and return. I found out I can get that behavior if I re-throw the error inside the catch, but I need to add another catch afterwards. </p>
  
  <p>So how can I return from the function if any of the promises get rejected ? (In this specific case they are one after the other so I guess I can use .then, but I want the same result if they are not nested).</p>
  
  <pre><code>async function something()
  {
      await asyncfunc().catch(e =&gt; console.error(e));
  }
  
  async function asyncfunc()
  {
      await some_promise.catch(err =&gt; { throw new Error(err) }); // Error gets swallowed unless I add another catch
  
      await some_promise2.catch(err =&gt; { throw new Error(err) }); // Error gets thrown here, return and don't execute promise 3
  
      var data = await some_promise3.catch(err =&gt; { throw new Error(err) });
  
      return data;
  }
  </code></pre>