title: Break promise map from within function value?
body: <p>In this example code below you can see that I have a chain of functions that are getting mapped, and when and when the error is thrown the chain is exited. The value of the global <code>x</code> is set to <code>bar</code> from the first function but it's not set to <code>baz</code> from the third because it never runs.</p>
  
  <pre><code>var x = "foo"
  
  Promise.map([
    function(){
      x = "bar"
      return true
    },
    function(){
      throw new Error()
    },
    function(){
      x = "baz"
      return true
    }
  ], function(fn){
    return Promise.method(fn)()
  })
  .catch(function(e){
    console.log(e) // [Error]
  })
  .then(function(){
    console.log(x) // "bar"
  })
  </code></pre>
  
  <p>However when I open up the promise within the map function and interject a conditionally thrown error <code>x</code> is changed to <code>baz</code>, and the third function does run. </p>
  
  <pre><code>var x = "foo"
  
  Promise.map([
    function(){
      x = "bar"
      return true
    },
    function(){
      return "bad value throw error"
    },
    function(){
      x = "baz"
      return true
    }
  ], function(fn){
    return Promise.method(fn)().then(function(val){
      if(val == "bad value throw error") throw new Error()
      return val
    })
  })
  .catch(function(e){
    console.log(e) // [Error]
  })
  .then(function(){
    console.log(x) // "baz"
  })
  </code></pre>
  
  <p>How can I interject an error in the promise map and throw that error breaking the map chain?</p>
  
  <p>Is there another bluebird method that can run an array of promises in series?</p>