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

Stack traces with Promise.method #359

Closed
mattdesl opened this Issue Oct 21, 2014 · 1 comment

Comments

Projects
None yet
3 participants
@mattdesl

mattdesl commented Oct 21, 2014

I've noticed that longStackTraces doesn't seem to work with Promise.method in Chrome. Here's a test case demonstrating the issue:

var Promise = require('bluebird')
Promise.longStackTraces()

function foo(data) {
    console.log(a)
    return 'value'
}

function node(data, cb) {
    console.log(a)
    cb(null, 'value')
}

Node-style callbacks:

var fooAsync = Promise.promisify(node)
fooAsync()

==>
    Possibly unhandled ReferenceError: a is not defined
        at node (http://localhost:9967/demo/test:11:14)
        at promisified (http://localhost:9967/demo/test:3654:22)
    From previous event:
        at promisified (http://localhost:9967/demo/test:3651:17)
        at Object.bluebird (http://localhost:9967/demo/test:17:1)
        at s (http://localhost:9967/demo/test:1:220)
        at e (http://localhost:9967/demo/test:1:391)
        at http://localhost:9967/demo/test:1:409 

With method:

var fooAsync = Promise.method(foo)
fooAsync()

==>
    Possibly unhandled ReferenceError: a is not defined
        at foo (http://localhost:9967/demo/test:6:14)
        at tryCatch1 (http://localhost:9967/demo/test:5078:21)
        at Promise$_method (http://localhost:9967/demo/test:2180:25)
        at Object.bluebird (http://localhost:9967/demo/test:17:1)
        at s (http://localhost:9967/demo/test:1:220)
        at e (http://localhost:9967/demo/test:1:391)
        at http://localhost:9967/demo/test:1:409 

Obviously it gets a bit more murky when the error is deep in some app:

at Object.module.exports.show (http://localhost:9966/demo/index.js:97:15)
    at tryCatch1 (http://localhost:9966/demo/index.js:17915:19)
    at Promise$_method (http://localhost:9966/demo/index.js:14996:25)
    at promise (http://localhost:9966/demo/index.js:12999:45)
    at http://localhost:9966/demo/index.js:68:23
    at tryCatch1 (http://localhost:9966/demo/index.js:17915:19)
    at Promise$_callHandler [as _callHandler] (http://localhost:9966/demo/index.js:15382:13)
    at Promise$_settlePromiseFromHandler [as _settlePromiseFromHandler] (http://localhost:9966/demo/index.js:15398:18)
    at Promise$_settlePromiseAt [as _settlePromiseAt] (http://localhost:9966/demo/index.js:15580:14)
    at Async$_consumeFunctionBuffer [as _consumeFunctionBuffer] (http://localhost:9966/demo/index.js:13216:12) 

@spion spion added the bug label Oct 21, 2014

@petkaantonov

This comment has been minimized.

Show comment
Hide comment
@petkaantonov

petkaantonov Oct 25, 2014

Owner

Fixed along with making the noise eliminator a bit better it now looks like this

Possibly unhandled ReferenceError: a is not defined
    at foo (c:\Users\Petka Antonov\bluebird\throwaway.js:7:17)
From previous event:
    at Object.<anonymous> (c:\Users\Petka Antonov\bluebird\throwaway.js:17:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Thanks!

I currently have problems with npm and cannot publish 2.3.7

Owner

petkaantonov commented Oct 25, 2014

Fixed along with making the noise eliminator a bit better it now looks like this

Possibly unhandled ReferenceError: a is not defined
    at foo (c:\Users\Petka Antonov\bluebird\throwaway.js:7:17)
From previous event:
    at Object.<anonymous> (c:\Users\Petka Antonov\bluebird\throwaway.js:17:1)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:906:3

Thanks!

I currently have problems with npm and cannot publish 2.3.7

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