title: How to stop executing next function with async-await?
body: <p>I'm using this library to chain asynchronous functions in my nodejs app:
  <a href="https://github.com/yortus/asyncawait" rel="nofollow">https://github.com/yortus/asyncawait</a></p>
  
  <pre><code>var chain = async(function(){
  
      var foo = await(bar());
      var foo2 = await(bar2());
      var foo3 = await(bar2());
  
  }
  </code></pre>
  
  <p>So bar3 waits for bar2 to finish and bar2 waits for bar() to finish. That's fine. But what will I do in order to stop the async block from further execution? I mean something like this:</p>
  
  <pre><code>var chain = async(function(){
  
      var foo = await(bar());
      if(!foo){return false;} // if bar returned false, quit the async block
      var foo2 = await(bar2());
      var foo3 = await(bar2());
  
  }
  </code></pre>
  
  <p>what's the best approach to handle this?</p>
  
  <p>at the moment I throw an exception within bar and handle the exception in way:</p>
  
  <pre><code>chain().catch(function (err) { //handler, ie log message)
  </code></pre>
  
  <p>It's working, but it doesn't look right</p>