Skip to content

BlueBird.promisifyAll fails #122

@theganyo

Description

@theganyo

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions