jeudi 4 janvier 2018

Nodejs debugging - auto generation of error message

I am new to nodejs (async) debugging. I would appreciate some help regarding error messages -

var l, m, opiton= {};
// option has actually been mis-spelt here as opiton

..... 
// some more code

option.name= "new name";

Now, at the point of assignment: option.name= "new name";
nodejs server freezes without any indication, that it has encountered an error.

It would be great if nodejs could "auto generate" an error message, and say -
undefined object "option" in line 5178 or something similar.

Figuring out that option was actually mis-spelt as opiton takes a lot of time, especially in a large code base, with multiple callbacks per request. And it would be great, if that time can be saved.

Question - Is there a generic solution for locating run-time errors in nodejs servers?

(In a large server code base, adding a ton of logging is useful for running analytics in production environment, but not the most optimum solution for a test environment)

Aucun commentaire:

Enregistrer un commentaire