3

Similar questions has been asked, I went through 'how to debug node' threads, but those are however either old or not about the problem i got.

Problem:

I'm writing some small tools in node.js stack - and my debugging experience is quite frustrating: when an exception is thrown, in many cases I get very annoying messages like the one here:

TypeError: Bad argument

wtf? it's neither verbose or useful - no source line number, no information in which file this exception was thrown.

Question:

How do I get my console to output usefull information when exceptions/errors are thrown and console.log function has something to say. would be great to have a simple console.log call where it actually puts a line number and maybe a file name where the message happens.

2
  • I don't know how to track the info you want on console but debugging is very easy with WebStorm IDE. I recommend it. Commented Jul 27, 2013 at 13:21
  • Use one of the debugging approaches from here: stackoverflow.com/questions/12641679/… Commented Aug 3, 2014 at 13:21

2 Answers 2

2

in nodejs i use this function to see error stack:

process.on('uncaughtException', function(err) {
    console.log(err.stack);
})
Sign up to request clarification or add additional context in comments.

Comments

0

Use the --stack option to see stack traces. Such as grunt task --stack

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.