I've been working on a project, a socket server, using NodeJS, with some great help from people on this site, my project is nearing completion, but I have an error generated on my code every once in a while, and I can't seem to pin point the error down, since the error log does not give a name of a variable, function or anything related to the problem, it just throws off this message:
Exception: TypeError: Cannot read property '0' of undefined
My problem also arises from the fact that there is nothing much moving in my code unless someone is connected to it, I do have an interval that runs every 4 minutes and send an update query to my DB so the connection to the DB will stay alive (we don't want to change the mySQL server wait_timeout since we use the same DB for other projects and products that needs it that way), and a kind of a global timer also set with setInterval that execute actions being sent to it from dynamicaly created game rooms, but again, the error pops up even if simply restart the service, and leave it untouched, it will come up every 10-20 minutes or so... So far I've been using this simple code to catch errors:
process.on('uncaughtException', function(err){
_log('Exception: ' + err+"<br>");
});
but this does not give the information I need to know how to debug and find the problem. My question is is there another way to handle these errors in a way that will return a little more information about the nature of the problem?
Thanks!