Debugging in JS

Hi @knolleary

I notice you just posted a topic on v1.2.4 of Node-RED here. Great to see the code based continue to be developed. Well done!

I was having a conversation with someone who is starting to experiment with Node-RED for his home automation system. He knows vastly more than I do about programming and yet he pointed out something that hadn't dawned on me about debugging.

I have come from using LUA to write scripts where debugging is very difficult, especially for a beginner.

When I moved to using Node-RED, I generally found that debugging much easier as you can very quickly isolate the bug to a single node and if you split your nodes neatly, there usually isn't a great deal of code to debug, however I have now started to realised that there is very little useful info (for me at least) that comes out of an error message.... to that point the errors are sometime completely meaningless / unhelpful.

The discussion I had was around this being a limitation of Java Script itself, however I was wondering if there was something more that you can do in the back-end of node-red to, by-default, expose more information on the nature/type/location etc of the errors that come through?

I have seen some of the nodes to catch errors and tricks to add debuggers in code, however I am not looking for a solution that requires nodes to be place all over my canvas or manual steps to be completed to debug, I'm wondering what can be done in the back-end to natively expose more information to support the debugging process.

If it helps, I can collate and share some of the errors I get and how useful/unuseful they are, and also have a think about what is lacking.

I'm not going to be surprised if you reply saying that I have asked you to look into a bottomless pit and where would you start, however I'm also not as uncertain as to what could be done pragmatically to improve the situation.

Glad to hear your thoughts.