Add error handling in app.js