title: Throw inside a callback inside a promise
body: <p>I know that stackoverflow is full of similar question and I've read a lot of them. </p>
  
  <p>From what I got a <code>throw</code> inside a promise should reject it, as I can read in the <a href="https://developer.mozilla.org/it/docs/Mozilla/JavaScript_code_modules/Promise.jsm/Promise" rel="noreferrer">documentation</a>:</p>
  
  <blockquote>
    <p>If the executor throws an exception, its value will be passed to the reject resolving function.</p>
  </blockquote>
  
  <p>But even after read a lot of post about promises and throw I still don't understand the snippet of code I'm pasting and why it happens.</p>
  
  <pre><code>function foo(a, b, cb) {
    setTimeout(() =&gt; {
      cb('Inner error *!?"$%&amp;#@"');
    }, 0);
  }
  
  const getThePromise = () =&gt; {
    return new Promise((resolve, reject) =&gt; {
      const cb = (err) =&gt; {
  
        /* &gt;&gt;&gt; ************ */
  
        throw err;       // catch not called
        // reject(err);  // catch called
  
        /* ************ &lt;&lt;&lt; */
  
      }
      foo('foo', 'dudee', cb);
    });
  }
  
  getThePromise()
  .catch((err) =&gt; {
    console.log('CATCH:', err);
  })
  .then((res) =&gt; {
    console.log('then...');
  })
  </code></pre>
  
  <p>I don't understand why if I use the <code>throw</code> the <code>.catch</code> of the promise is not called but if I use the <code>reject</code> it is called.</p>
  
  <p>Just for sake of clarification I'm using Node.js v6.2.2 in a Mac OS/X 10.11 but I don't think it could be also a browser issue.</p>