Skip to content

Commit

Permalink
chore: throw if toAssignId is null
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Aug 27, 2024
1 parent ad911c1 commit 5158cbe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/handlers/shared/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,17 @@ export async function start(context: Context, issue: Context["payload"]["issue"]
}

const duration: number = calculateDurations(labels).shift() ?? 0;
const toAssignIds = toAssign.map(async (u) => await fetchUserId(context, u));
const toAssignIds = toAssign.map(async (u) => {
const userId = await fetchUserId(context, u);

if (!userId) {
throw new Error(logger.error("User not found", { user: u }).logMessage.raw);
}

return userId;
});



const assignmentComment = await generateAssignmentComment(context, issue.created_at, issue.number, sender.id, duration);
const logMessage = logger.info("Task assigned successfully", {
Expand Down

0 comments on commit 5158cbe

Please sign in to comment.