@@ -159,6 +159,7 @@ async function createBranchOnProject(projectURL, token)
159159 else
160160 {
161161 console . error ( 'Error creating new branch: ' , newBranchData ) ;
162+ alert ( "Failed to create branch on project! Error code: " , newBranchResponse . status , ". Please check API Key permissions and try again." )
162163 return false ;
163164 }
164165 }
@@ -190,7 +191,7 @@ async function addFileToBranch(projectURL, token, codeJSONObj)
190191 body : JSON . stringify ( {
191192 message : "Add codejson to project" ,
192193 committer : {
193- name : "CodeJSON formsite " ,
194+ name : "codejson-generator form site " ,
194195 email : "opensource@cms.hhs.gov"
195196 } ,
196197 content : encodedContent ,
@@ -209,6 +210,7 @@ async function addFileToBranch(projectURL, token, codeJSONObj)
209210 else
210211 {
211212 console . error ( 'Error adding file: ' , data ) ;
213+ alert ( "Failed to add file on project! Error code: " , response . status , ". Please check API Key permissions and try again." )
212214 return false ;
213215 }
214216}
@@ -227,7 +229,7 @@ async function createPR(projectURL, token)
227229 } ,
228230 body : JSON . stringify ( {
229231 title : "Add code.json to Project" ,
230- body : "Add generated code.json file to project. Code.json was generated via a form.io form site." ,
232+ body : "Add generated code.json file to project. Code.json was generated via codejson-generator form site." ,
231233 head : NEW_BRANCH ,
232234 base : 'main' ,
233235
@@ -245,6 +247,7 @@ async function createPR(projectURL, token)
245247 else
246248 {
247249 console . error ( "Error creating PR!: " , data ) ;
250+ alert ( "Failed to create PR on project! Error code: " , response . status , ". Please check API Key permissions and try again." )
248251 return false ;
249252 }
250253}
@@ -279,18 +282,22 @@ async function createProjectPR(event){
279282 }
280283 }
281284 }
285+ else
286+ {
287+ console . error ( "Could not create branch on requested repository with the requested API key!" )
288+ }
282289 }
283290 else
284291 {
285292 console . error ( "No URL found!" ) ;
286- alert ( "No URL given for project!" ) ;
293+ alert ( "No URL given for project! Please provide project URL in repositoryURL text box " ) ;
287294 }
288295
289296 }
290297 else
291298 {
292299 console . error ( "No API key found!" ) ;
293- alert ( "No Api Key in submitted data!" ) ;
300+ alert ( "No API Key in submitted data! Please provide an API key " ) ;
294301 }
295302 //console.log(codeJSONObj)
296303}
0 commit comments