Add error handling for createApplication.