debug code in app.js for catching uncaught errors