Skip to content

Commit

Permalink
chore: throw logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Nov 8, 2024
1 parent 3317d59 commit ed12d21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
17 changes: 3 additions & 14 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
{
"name": "Start | Stop",
"description": "Assign or un-assign yourself from an issue.",
"ubiquity:listeners": [
"issue_comment.created",
"issues.assigned",
"issues.unassigned",
"pull_request.opened",
"pull_request.edited"
],
"ubiquity:listeners": ["issue_comment.created", "issues.assigned", "issues.unassigned", "pull_request.opened", "pull_request.edited"],
"commands": {
"start": {
"ubiquity:example": "/start",
Expand Down Expand Up @@ -51,12 +45,7 @@
"type": "string"
},
"rolesWithReviewAuthority": {
"default": [
"COLLABORATOR",
"OWNER",
"MEMBER",
"ADMIN"
],
"default": ["COLLABORATOR", "OWNER", "MEMBER", "ADMIN"],
"type": "array",
"items": {
"type": "string"
Expand All @@ -80,4 +69,4 @@
"requiredLabelsToStart"
]
}
}
}
6 changes: 5 additions & 1 deletion src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ 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 new Error("This task does not reflect a business priority at the moment and cannot be started. This will be reassessed in the coming weeks.");
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,
});
}

if (!sender) {
Expand Down
6 changes: 3 additions & 3 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,9 @@ describe("User start/stop", () => {

context.adapters = createAdapters(getSupabase(), context);

await expect(userStartStop(context)).rejects.toThrow(
"This task does not reflect a business priority at the moment and cannot be started. This will be reassessed in the coming weeks."
);
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." },
});
});
});

Expand Down

0 comments on commit ed12d21

Please sign in to comment.