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

Broken on v0.11.0 #12

Closed
codenothing opened this issue Mar 31, 2013 · 3 comments
Closed

Broken on v0.11.0 #12

codenothing opened this issue Mar 31, 2013 · 3 comments

Comments

@codenothing
Copy link

Getting an error at the end of a program when using longjohn (0.2.0):

require( 'longjohn' );

console.log( 'Start' );
setTimeout(function(){
    console.log( 'Timeout' );
}, 1000);
corey@corey-mac:~/git/lj$ node test.js
Start
Timeout

/Users/corey/git/lj/node_modules/longjohn/dist/longjohn.js:181
        throw e;
              ^
TypeError: Function.prototype.apply: Arguments list has wrong type
    at Function.prepareStackTrace (/Users/corey/git/lj/node_modules/longjohn/dist/longjohn.js:123:48)
    at new Error (<anonymous>)
    at wrap_callback (/Users/corey/git/lj/node_modules/longjohn/dist/longjohn.js:167:19)
    at process.nextTick (/Users/corey/git/lj/node_modules/longjohn/dist/longjohn.js:257:15)
    at onwrite (_stream_writable.js:249:15)
    at WritableState.onwrite (_stream_writable.js:92:5)
    at WriteStream.Socket._write (net.js:634:5)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)
    at WriteStream.Writable.write (_stream_writable.js:172:11)
@ryanlatham
Copy link

It looks like longjohn's format_stack function never gets called, leaving the stack in a bad state. As for why its not getting called, this code (from prepareStackTrace) :

if error.__previous__?
  previous_stack = error.__previous__.stack
  if previous_stack?.length > 0
    error.__cached_trace__.push(create_callsite(exports.empty_frame))
    error.__cached_trace__.push(previous_stack...)

fails to take into account the case when previous_stack is a string, not an array. The failure leads to a TypeError: Function.prototype.apply: Arguments list has wrong type exception, preventing longjohn from running format_stack.

I was going to make a pull request with the fix, but right out of the box there are 5 test failures, so I am hesitant to touch anything at this point. If some of these errors get resolved, then I will make a request.

@tvervest
Copy link

tvervest commented Mar 3, 2015

Any news on this issue (or the PR?). I'm having the same problem and I'm sure I'm not the only one ;) It would be great if we could manage to get a PR (without failing tests ;)) merged into the project.

@mattinsler
Copy link
Owner

Fixed by PR.

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

4 participants