Skip to content

Commit

Permalink
refactor: move error outside of loop
Browse files Browse the repository at this point in the history
  • Loading branch information
JBR90 committed Nov 22, 2024
1 parent cf48fdf commit b17a846
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions apps/nextjs/src/app/api/cron-jobs/expired-exports/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,13 @@ async function updateExpiredAtAndDelete(fileIds: string[]) {
log.error(`Error processing file with gdriveFileId: ${id}`, error);
failedIds.push(id);
}

if (failedIds.length > 0) {
const errorMessage = `Failed to process the following file IDs: ${failedIds.join(
", ",
)}`;
log.error(errorMessage);
throw new Error(errorMessage);
}
}
if (failedIds.length > 0) {
const errorMessage = `Failed to process the following file IDs: ${failedIds.join(
", ",
)}`;
log.error(errorMessage);
throw new Error(errorMessage);
}
}

Expand Down

0 comments on commit b17a846

Please sign in to comment.