Skip to content

Commit

Permalink
Merge pull request #87 from rndquu/feat/new-priority-msg
Browse files Browse the repository at this point in the history
feat: new error msg on missing required label
  • Loading branch information
0x4007 authored Nov 18, 2024
2 parents 0480ab3 + ef6198a commit ee4f7c6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 8 additions & 5 deletions src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ export async function start(

if (requiredLabelsToStart.length && !requiredLabelsToStart.some((label) => issueLabels.includes(label))) {
// The "Priority" label must reflect a business priority, not a development one.
throw logger.error("This task does not reflect a business priority at the moment and cannot be started. This will be reassessed in the coming weeks.", {
requiredLabelsToStart,
issueLabels,
issue: issue.html_url,
});
throw logger.error(
`This task does not reflect a business priority at the moment. You may start tasks with one of the following labels: ${requiredLabelsToStart.join(", ")}`,
{
requiredLabelsToStart,
issueLabels,
issue: issue.html_url,
}
);
}

if (!sender) {
Expand Down
4 changes: 3 additions & 1 deletion tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ describe("User start/stop", () => {
context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toMatchObject({
logMessage: { raw: "This task does not reflect a business priority at the moment and cannot be started. This will be reassessed in the coming weeks." },
logMessage: {
raw: "This task does not reflect a business priority at the moment. You may start tasks with one of the following labels: Priority: 3 (High), Priority: 4 (Urgent), Priority: 5 (Emergency)",
},
});
});
});
Expand Down

0 comments on commit ee4f7c6

Please sign in to comment.