title: Bluebird's Promise resolve returns undefined
body: <p>I'm new to Promise, so I was trying out Bluebird's Promise APIs. I have the following method that returns a <code>Promise.try()</code></p>
  
  <p><strong>CheckDb - Promise Method</strong></p>
  
  <pre><code>const Prom = require("bluebird")
  
  ..........
  ..........
  
  let checkDb = () =&gt; {
   return Prom.try(() =&gt; {
     SomePromiseMethod().then(result =&gt; {
      if (//some condition) {
        let resp = { 
            res: result, 
            somethingelse : somethingelse 
        }
        return Prom.resolve(resp)
      }
      else 
        return Prom.reject(new Error("some reason"));
     }, err =&gt; {
        return Prom.reject(err);
     })
     .catch(err =&gt; {
       return Prom.reject(err);
     });
   });
  }
  </code></pre>
  
  <p><strong>SomeTask - Method calling the promise method</strong></p>
  
  <pre><code>exports.someTask = () =&gt; {
        checkDb().then(resolved =&gt; {
         console.log(resolved) // coming undefined
        }, 
        rejected =&gt; {
         console.error(rejected);
        })
        .catch(err =&gt; {console.error(err)});
      }
  </code></pre>
  
  <p>The problem here is that the <code>resolved</code> component of the <code>then</code> method of the Promise function is returning undefined.</p>
  
  <p>I looked into <a href="https://stackoverflow.com/questions/37361908/bluebird-promises-returns-undefined-when-return-inside-then-function">this</a> and <a href="https://stackoverflow.com/questions/33966436/bluebird-promise-resolvedata-is-undefined-in-client-code">this</a>, but couldn't figure it out.</p>