Skip to content

Commit 8614337

Browse files
Added log in catch after creating app on appcenter (#1971)
* Added getting owner name if app already exists * Added catch and logs
1 parent 0a3db5a commit 8614337

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

Examples/create-app.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,18 @@ linkCodePush(androidStagingDeploymentKey, iosStagingDeploymentKey);
8383
function createCodePushApp(name, os) {
8484
try {
8585
console.log(`Creating CodePush app "${name}" to release updates for ${os}...`);
86-
const appResult = execCommand(`appcenter apps create -d ${name} -n ${name} -o ${os} -p React-Native --output json`);
87-
const app = JSON.parse(appResult);
88-
owner = app.owner.name;
89-
console.log(`App "${name}" has been created \n`);
86+
try {
87+
const appResult = execCommand(`appcenter apps create -d ${name} -n ${name} -o ${os} -p React-Native --output json`);
88+
const app = JSON.parse(appResult);
89+
owner = app.owner.name;
90+
console.log(`App "${name}" has been created \n`);
91+
} catch(e) {
92+
console.log("Error: ", e);
93+
console.log(`Please check that you haven't application with "${name}" name on portal`);
94+
}
9095
execCommand(`appcenter codepush deployment add -a ${owner}/${name} Staging`);
9196
} catch (e) {
92-
console.log(`App "${name}" already exists \n`);
97+
console.log("Error", e);
9398
}
9499
const deploymentKeysResult = execCommand(`appcenter codepush deployment list -a ${owner}/${name} -k --output json`);
95100
const deploymentKeys = JSON.parse(deploymentKeysResult);

0 commit comments

Comments
 (0)