Skip to content

Commit

Permalink
Add more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
adityaoberai committed Apr 17, 2024
1 parent 190733a commit 7a12e88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/AltText.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,21 @@ async function generateAltText(imageBase64) {
},
});
switch(response.status) {
case 413:
case 413:
console.error(response);
throw new Error("Image is too large, please send files smaller than 4.5 MB.");
case 504:
console.error(response);
throw new Error("Request timed out, please try again.");
case 200:
const responseBody = await response.json();
altText = responseBody.message;
break;
default:
default:
console.error(response);
throw new Error("An unknown error occured, please try again.");
}
} catch(error) {
Expand Down

0 comments on commit 7a12e88

Please sign in to comment.