Promise reject not working inside of callback
<p>I'm writing a module that uses the Google API, but am wrapping everything that is callback based in a promise. This is the code of the problem area</p>

<p>file1.js</p>

<pre><code>var File2 = require('file2')
var api = new File2()
api.auth().then(auth =&gt; {
  api.search('example').then(res =&gt; {
     ...do some stuff...
  })
}).catch(err =&gt; {
  console.log('1') //Not being run
  throw err
})
</code></pre>

<p>file2.js</p>

<pre><code>class File2(){
  auth() {
    ...works fine and resolves...
  }

  search() {
     return new Promise((resolve, reject) =&gt; {
       googleapi.somemethod(options, (err, res) =&gt; {
         if(err) { 
           console.log('2') // DOES run
           reject(new Error(err))
         }
         resolve(res.field) //Program crashes here because reject didn't actually reject
       })
     })

}
</code></pre>

<p>The call to <code>auth</code> is working just fine, but the call to <code>search</code> (and more specifically <code>googleapi.somemethod</code>) is failing, and <code>err</code> is defined. I check for err, and <code>console.log('2')</code> runs, but then <code>console.log('1')</code> in <code>catch</code> doesn't run, the error isn't thrown, and the program crashed on <code>resolve(res)</code> because <code>res</code> is undefined. I've tried putting the error catcher as the second argument to <code>then</code> instead of using <code>catch</code>, but that still doesn't work</p>

<pre><code>api.search('example').then(res =&gt; {
  ...do some stuff...
 }, err =&gt; {
    console.log('2') // Still doesn't run
    throw err
 })
</code></pre>

<p>I'm running Node v6.2.1</p>