Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BlueBird.promisifyAll fails #122

Open
theganyo opened this issue Aug 5, 2015 · 0 comments
Open

BlueBird.promisifyAll fails #122

theganyo opened this issue Aug 5, 2015 · 0 comments

Comments

@theganyo
Copy link
Member

theganyo commented Aug 5, 2015

The test script below succeeds in node.js with output of:

{ [Error: boo!] cause: [Error: boo!], isOperational: true }
{ [Error: boo!] cause: [Error: boo!], isOperational: true }

And fails in Trireme with output of:

{ [Error: boo!]
  name: 'Error',
  message: 'boo!',
  cause: [Error: boo!],
  isOperational: true,
  stack: undefined }
{ [TypeError: Cannot call method "apply" of undefined]
  message: 'Cannot call method "apply" of undefined',
  fileName: '/Users/sganyo/node_modules/bluebird/js/main/promisify.js#163(Function)',
  lineNumber: 11 }

The key item of note is that on Trireme, BlueBird.promisifiy() works where BlueBird.promisifyAll() fails.

'use strict';
var BlueBird = require('bluebird');

var module = (function() {
  var me = {};
  me.fail = function fail(cb) {
    cb(new Error('boo!'));
  };
  return me;
})();

function test(promisedFunction) {
  promisedFunction()
    .then(function(result) {
      console.log(result);
    })
    .catch(function(err) {
      console.log(err);
    });
}

// works in Trireme
var promisifyFail = BlueBird.promisify(module.fail);
test(promisifyFail);


// fails in Trireme
var asyncModule = BlueBird.promisifyAll(module);
var promisifyAllFail = asyncModule.failAsync;
test(promisifyAllFail);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant