What is the best way to catch ReferenceError or TypeError in node.js?

What is the best way to catch ReferenceError or TypeError in node.js? I was wondering if I can prevent node.js servers from being crashed by such errors...

Thanks!

use forever, it will keep your app running... forever

it's an app made by nodejitsu, that restarts the server anytime it encounters a fatel error.