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

New warnings should indicate origin #861

Closed
floross opened this issue Nov 9, 2015 · 5 comments
Closed

New warnings should indicate origin #861

floross opened this issue Nov 9, 2015 · 5 comments

Comments

@floross
Copy link

floross commented Nov 9, 2015

The new warnings introduces by bluebird 3 are quite handy to avoid bugs, but the error they refer to can be quite hard to pinpoint in large codebases:

Warning: a promise was created in a  handler but was not returned from it
at processImmediate [as _immediateCallback] (timers.js:367:17)

In my case this was due to the use of old-style callbacks that didn't return anything, but maybe Bluebird could somewhat use the longStackTrace mechanism to indicate the origin of the error to facilitate debugging.

@petkaantonov
Copy link
Owner

There should be a long stack trace as this warning is not even enabled if long stack traces are not enabled

@floross
Copy link
Author

floross commented Nov 10, 2015

Long stack traces are enable but I go the error above anyway.

My bluebird configuration:

Promise.config({
    warnings: true,
    longStackTraces: true,
});

@floross
Copy link
Author

floross commented Nov 10, 2015

This code can reproduce the error:

var Promise = require('bluebird');

Promise.config({
    warnings: true,
    longStackTraces: true,
});

Promise.resolve()
    .then(function () {
        Promise.resolve();
    })
;

This warning show up:

Warning: a promise was created in a  handler but was not returned from it
    at processImmediate [as _immediateCallback] (timers.js:367:17)

Ps: I'am currently using the 3.0.5 version of bluebird

@petkaantonov
Copy link
Owner

Thanks, I'll look into it

@petkaantonov
Copy link
Owner

This was actually bug with Promise.resolve rather than the warning system

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants