How to get errors/exceptions while developing custom node?

Yes, I know the feeling...

I have developed my own workaround. But it is rather unorthodox and I have no clue whether it works on all platforms!!!! However it works fine on my Raspberry.

After I install a new version of Node-RED, I always add an extra console log line to the Node-RED code, where the nodes are being loaded and parsed (/usr/lib/node_modules/node-red/node_modules/@node-red/registry/lib/loader.js), in the loadNodeSet function:

image

Now suppose I have an error in one of my custom nodes:

image

Then at startup I see at least where it is going wrong:

image

Not a very elegant solution, but it has saved me lots of time guessing about what is going wrong ...
P.S. I also think it doesn't report all errors, but I'm not sure at the moment.

2 Likes