From b2c10db130c5ac612fa4dda9e7c5e68ca5cc371e Mon Sep 17 00:00:00 2001 From: ThisBirchWood Date: Tue, 10 Jun 2025 10:15:41 +0200 Subject: [PATCH] IMPROVE error checking on frontend --- frontend/src/components/video/ClipConfig.tsx | 2 +- frontend/src/pages/ClipEdit.tsx | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/video/ClipConfig.tsx b/frontend/src/components/video/ClipConfig.tsx index 46385a1..fe18d2c 100644 --- a/frontend/src/components/video/ClipConfig.tsx +++ b/frontend/src/components/video/ClipConfig.tsx @@ -62,7 +62,7 @@ export default function ClipConfig({setMetadata, className}: prop) { - + { }); const [progress, setProgress] = useState(0); const [downloadable, setDownloadable] = useState(false); + const [error, setError] = useState(null); const sendData = async() => { if (!id) return; setDownloadable(false); - await editFile(id, outputMetadata); + const edited = await editFile(id, outputMetadata); const processed = await processFile(id); + if (!edited) { + console.log("Failed to edit file"); + setError("Failed to edit file. Please check the metadata and try again."); + return; + } + if (!processed) { console.log("Failed to process file"); + setError("Failed to process file. Please try again later."); return; } @@ -122,7 +130,14 @@ const ClipEdit = () => { setMetadata={setOutputMetadata} className={"w-full mt-2 bg-primary"} /> - } + + {error && ( +
+ {error} +
+ )} + + }