Properly show errors in file bars again

This commit is contained in:
G2-Games 2024-10-31 04:51:07 -05:00
parent ca63739bfb
commit 4ca0f50685

View file

@ -83,9 +83,11 @@ async function uploadFile(file, duration, maxSize) {
const [linkRow, progressBar, progressText] = await addNewToList(file.name); const [linkRow, progressBar, progressText] = await addNewToList(file.name);
if (file.size > maxSize) { if (file.size > maxSize) {
console.error("Provided file is too large", file.size, "bytes; max", maxSize, "bytes"); console.error("Provided file is too large", file.size, "bytes; max", maxSize, "bytes");
makeErrored(progressBar, progressText, linkRow, TOO_LARGE_TEXT);
return; return;
} else if (file.size == 0) { } else if (file.size == 0) {
console.error("Provided file has 0 bytes"); console.error("Provided file has 0 bytes");
makeErrored(progressBar, progressText, linkRow, ZERO_TEXT);
return; return;
} }
@ -106,6 +108,7 @@ async function uploadFile(file, duration, maxSize) {
chunkedResponse = await response.json(); chunkedResponse = await response.json();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
makeErrored(progressBar, progressText, linkRow, ERROR_TEXT);
} }
// Upload the file in `chunk_size` chunks // Upload the file in `chunk_size` chunks