[Stability] Update main.js 

Add a global catch on unexpected exception so the server keep running.