Skip to content

Commit

Permalink
FIX: Script didn't throw errors correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
roelmagdaleno committed Aug 23, 2021
1 parent e6d5504 commit 41373b6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2331,19 +2331,16 @@ async function run() {
const oauthToken = await getOauthToken();

if (oauthToken.error) {
core.error(oauthToken.error_description);
return;
throw new Error(oauthToken.error_description);
}

if (!oauthToken.access_token || oauthToken.access_token === '') {
core.error('The access token does not exist.');
return;
throw new Error('The access token does not exist.');
}

await deployChanges(oauthToken.access_token).then(response => {
if (!response.ok) {
core.error(response.body.error_description);
return;
throw new Error(response.body.error_description);
}

core.info(`Success. Operation ID: ${ response.body.operation_id }`);
Expand Down
9 changes: 3 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,16 @@ async function run() {
const oauthToken = await getOauthToken();

if (oauthToken.error) {
core.error(oauthToken.error_description);
return;
throw new Error(oauthToken.error_description);
}

if (!oauthToken.access_token || oauthToken.access_token === '') {
core.error('The access token does not exist.');
return;
throw new Error('The access token does not exist.');
}

await deployChanges(oauthToken.access_token).then(response => {
if (!response.ok) {
core.error(response.body.error_description);
return;
throw new Error(response.body.error_description);
}

core.info(`Success. Operation ID: ${ response.body.operation_id }`);
Expand Down

0 comments on commit 41373b6

Please sign in to comment.