Catching authentication and target not set error in app.run().