Q:

Promisifying node.js class generator method

I'm trying to promisify the the someAsyncMethod in the following code. 
When I run the the code, the yielded promise of the someAsyncMethod is never resolved. 
Can someone tell me what I'm doing wrong?
'use strict';
var someapi = require('./lib/absenceio');
var Promise = require('bluebird');

class CompanyController {
    constructor(currentUser, parameters) {

    }
    * someAsyncMethod () {      
        return yield someapi.listReasons(); // returns a promise
    }
}

Promise.coroutine(function*(){
    var c = new CompanyController();
    Promise.promisifyAll(c);    
    var res = yield c.someAsyncMethodAsync();
    console.log('never reached');
})();

A:

someAsyncMethod() is a generator function, which you can't yield directly, but you can delegate to it using yield*.
So, your code becomes this:
var res = yield* c.someAsyncMethod();

No need to promisify it (I'm not even sure what Bluebird does when asked to promisify a generator function).

