Trying to catch error

This commit is contained in:
Khalim Conn-Kowlessar 2023-07-14 15:55:01 +01:00
parent 6d4988c46b
commit 7298428686

View file

@ -39,11 +39,17 @@ async function uploadCsvToS3({
file: File;
}) {
try {
await fetch(presignedUrl, {
const response = await fetch(presignedUrl, {
method: "PUT",
body: file,
headers: { "Content-Type": "text/csv" },
});
if (!response.ok) {
console.error(response.text);
console.error(response);
throw new Error("Network response was not ok");
}
} catch (error) {
console.error(error);
throw new Error("Upload failed.");