Add error handling for app.