improve error handling on upload failures
This commit is contained in:
@@ -153,7 +153,6 @@ import {
|
||||
import { closeDialog } from "../SMDialog";
|
||||
import { api } from "../../helpers/api";
|
||||
import { Media, MediaCollection, MediaResponse } from "../../helpers/api.types";
|
||||
import { bytesReadable } from "../../helpers/types";
|
||||
import { useApplicationStore } from "../../store/ApplicationStore";
|
||||
import SMButton from "../SMButton.vue";
|
||||
import SMFormCard from "../SMFormCard.vue";
|
||||
@@ -342,12 +341,11 @@ const handleClickInsert = async () => {
|
||||
let timeout = 0;
|
||||
while (mediaProcessed == false) {
|
||||
timeout++;
|
||||
if (timeout >= 240) {
|
||||
if (timeout >= 60) {
|
||||
mediaProcessed = true;
|
||||
uploadForm._message =
|
||||
"Timed out processing the file. Please try again later.";
|
||||
}
|
||||
|
||||
"The server is taking longer then expected to process the file.\nOnce the file has been processed, select it from the media browser.";
|
||||
} else {
|
||||
await new Promise((resolve) =>
|
||||
setTimeout(resolve, 500)
|
||||
);
|
||||
@@ -362,7 +360,9 @@ const handleClickInsert = async () => {
|
||||
const updateData =
|
||||
updateResult.data as MediaResponse;
|
||||
|
||||
if (updateData.medium.status == "") {
|
||||
if (
|
||||
updateData.medium.status == ""
|
||||
) {
|
||||
data.medium = updateData.medium;
|
||||
mediaProcessed = true;
|
||||
} else if (
|
||||
@@ -383,9 +383,12 @@ const handleClickInsert = async () => {
|
||||
"An server error occurred processing the file.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (data.medium.status.length == 0) {
|
||||
closeDialog(data.medium);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user