Skip to content

Commit

Permalink
Fix: If a single image gen breaks, that should not break the whole thing
Browse files Browse the repository at this point in the history
  • Loading branch information
jayantbh committed Dec 12, 2023
1 parent ac5a161 commit 07b5e11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/api-helpers/image-gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ export const generateImages = async (
createImageUsingVercel(
{ ...adaptedData[cardName], username: data.user.login },
cardName
)
).catch(() => null)
)
);

return imageFileBuffers;
return imageFileBuffers.filter(Boolean) as ImageFile[];
} catch (error) {
console.error('Error in generateImages:', error);
logException('Error in generateImages', { originalException: error });
Expand Down
2 changes: 1 addition & 1 deletion src/api-helpers/vercel-generator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export const createImageUsingVercel = async (
try {
imageArrayBuffer = await generatedImage.arrayBuffer();
} catch (error) {
logException('Error converting image to array buffer for ${cardType}', {
logException(`Error converting image to array buffer for ${cardType}`, {
originalException: error
});
throw new Error(`Image buffer creation failed for ${cardType}`);
Expand Down

0 comments on commit 07b5e11

Please sign in to comment.