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

Always print AsyncProfile.create #8

Open
clevertension opened this issue Nov 24, 2014 · 5 comments
Open

Always print AsyncProfile.create #8

clevertension opened this issue Nov 24, 2014 · 5 comments

Comments

@clevertension
Copy link

0.127: 0.455ms  at AsyncProfile.create (/Users/dan/test-async-profile/node_modules/async-profile/lib/index.js:61:27) (0.072)
5.560: 2.849ms    at AsyncProfile.create (/Users/dan/test-async-profile/node_modules/async-profile/lib/index.js:61:27) (0.169)
8.590: 0.006ms      at AsyncProfile.create (/Users/dan/test-async-profile/async-profile/lib/index.js:61:27) (0.000)
8.600: 0.003ms      at AsyncProfile.create
@clevertension clevertension changed the title Alway print AsyncProfile.create Always print AsyncProfile.create Nov 24, 2014
@spifd
Copy link

spifd commented Dec 1, 2014

I have the same problem after a short test in my app. Haven't tried on unit test. I'm using a promise chain using when.js and I also have only AsyncProfile.create displayed instead of actual functions.

@ConradIrwin
Copy link
Owner

The bug is probably in this code: https://github.com/ConradIrwin/async-profile/blob/master/src/result.coffee#L57-L72

Please let me know if you can reproduce it with a small example (or even debug it yourself ;), the code goes to some lengths to avoid this happening.

@clevertension
Copy link
Author

hi ConradIrwin, i think the root cause of this issue is "err = new Error()", we should create error in the callback context, not async-profile itself, for example:

a.test(param1, function(b) {
    var err1 = new Error();
    b.test(param2, function(c) {
        var err2 = new Error();
        c.test(param3, function(d) {
              var err3 = new Error();
              //....
        }
   });
});

but when i review your code, the error is created inside async profile, so it will always print this code

@qraynaud
Copy link

Same problem here…

@lfdoherty
Copy link

The bug seems to be because the NPM version (0.4.0) is different from the version on GitHub. NPM's second lines loop, corresponding to this:
https://github.com/ConradIrwin/async-profile/blob/master/src/result.coffee#L69
uses this test in its Javascript version:
if (l.indexOf(process.cwd()) > -1) {
Instead of this:
if (l.indexOf(process.cwd()) > -1 && l.indexOf('async-profile') === -1) {

Correcting that line gets rid of all the "AsyncProfile.create" stuff.

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

No branches or pull requests

5 participants