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

More detailed stack traces from threads #655

Closed
milonas115 opened this issue Nov 20, 2015 · 4 comments
Closed

More detailed stack traces from threads #655

milonas115 opened this issue Nov 20, 2015 · 4 comments

Comments

@milonas115
Copy link

restarting thread 2 due to error TypeError: Cannot read property 'index' of undefined


How do I get errors happening inside threads to show full stack traces without having to try/catch everything.

@obastemur
Copy link
Member

/cc @ktrzeciaknubisa ?

@ktrzeciaknubisa
Copy link
Member

Well, I thought, that uncaughtException for the thread would work, but apparently it doesn't (and never did - I've checked with "ancient" JXcore 0.2.3.7)

var method = function() {

  process.on('uncaughtException', function(ex) {
    console.log('ex', ex);
  });

  var s = nonexistentFunc();
}
jxcore.tasks.addTask(method);

I thing it's a need to add at least exception message (if not full stack trace) to process.on('restart') listener.

Because once you'll subscribe for that event, you no longer receive the error, which normally would be:

ReferenceError: nonexistentFunc is not defined

@obastemur
Copy link
Member

Actually the uncaughtException only kicks in when the error is happening after the initial context load. In this case, if you would run the throwing part inside a setTimeout etc. you would have the event call.

obastemur added a commit that referenced this issue Nov 23, 2015
@obastemur
Copy link
Member

jxcore 0.3.1.0 will be printing stack trace for the errors on global context.

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

3 participants