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

Comments

Projects
None yet
2 participants
@floross

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

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Nov 9, 2015

Owner

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

Owner

petkaantonov commented Nov 9, 2015

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

@floross

This comment has been minimized.

Show comment
Hide comment
@floross

floross 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 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

This comment has been minimized.

Show comment
Hide comment
@floross

floross 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

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

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Nov 10, 2015

Owner

Thanks, I'll look into it

Owner

petkaantonov commented Nov 10, 2015

Thanks, I'll look into it

petkaantonov added a commit that referenced this issue Dec 1, 2015

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Dec 1, 2015

Owner

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

Owner

petkaantonov commented Dec 1, 2015

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