Skip to content

New warnings should indicate origin #861

Closed

Description

@floross

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.

Activity

  1. petkaantonov commented on Nov 9, 2015

    @petkaantonov
    Owner

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

  2. floross commented on Nov 10, 2015

    @floross
    Author

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

    My bluebird configuration:

    Promise.config({
        warnings: true,
        longStackTraces: true,
    });
  3. floross commented on Nov 10, 2015

    @floross
    Author

    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

  4. petkaantonov commented on Nov 10, 2015

    @petkaantonov
    Owner

    Thanks, I'll look into it

  5. added a commit that references this issue on Dec 1, 2015
    23d3516
  6. petkaantonov commented on Dec 1, 2015

    @petkaantonov
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions