Skip to content

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
peaceiris committed Mar 8, 2020
1 parent 1243e8a commit 76985bf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,12 @@ export async function run(): Promise<void> {
});

if (!isExistLabel) {
core.info(`[INFO] no configuration for labels.${labelName}`);
core.info(`[INFO] no configuration labels.${labelName}`);
return;
}

if (config.labels[labelIndex][`${labelEvent}`] === void 0) {
core.info(
`[INFO] no configuration for labels.${labelName}.${labelEvent}`
);
core.info(`[INFO] no configuration labels.${labelName}.${labelEvent}`);
return;
}

Expand All @@ -93,7 +91,7 @@ export async function run(): Promise<void> {
config.labels[labelIndex][`${labelEvent}`].pr === void 0
) {
throw new Error(
`not found any definition for labels.${labelName}.${labelEvent}`
`not found any definition labels.${labelName}.${labelEvent}`
);
}

Expand Down Expand Up @@ -133,9 +131,13 @@ export async function run(): Promise<void> {
await closeIssue(githubClient, issueNumber);
} else if (finalAction === 'open') {
await openIssue(githubClient, issueNumber);
} else {
} else if (finalAction === '') {
core.info(
`[INFO] no configuration for labels.${labelName}.${labelEvent}.${eventType}.action`
`[INFO] no configuration labels.${labelName}.${labelEvent}.${eventType}.action`
);
} else {
throw new Error(
`invalid value "${finalAction}" labels.${labelName}.${labelEvent}.${eventType}.action`
);
}

Expand Down

0 comments on commit 76985bf

Please sign in to comment.