Skip to content

Promise.coroutine() is difficult to debug #421

@petehunt

Description

@petehunt

First of all thanks for your great work on bluebird.

The following code sample (at scale) is very difficult to debug:

var Promise = require('bluebird');

Promise.longStackTraces();

var coro = Promise.coroutine(function*() {
  yield 7;
});

coro();
[petehunt@petehunt-mbp tmp]$ node --harmony break.js
Possibly unhandled TypeError: A value was yielded that could not be treated as a promise

    See http://goo.gl/4Y4pDk

From previous event:
From previous event:
    at Object.<anonymous> (/Users/petehunt/tmp/break.js:9:1)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:349:32)
    at Function.Module._load (module.js:305:12)
    at Function.Module.runMain (module.js:490:10)
    at startup (node.js:124:16)

I understand that it's likely impossible to capture a perfect stack trace, but I spent hours tracking down this bug and was hoping to get a better error message. I took a rough pass at an improvement here: petehunt@d15a93c

Is this something worth cleaning up and trying to get in? Or is this something you'd want to do? Or is this not worth doing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions