Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

fix(web): handle download errors in VideoDownloadMenu

Richie McIlroy0e6704407af5
diff --git a/apps/web/app/s/[videoId]/_components/VideoDownloadMenu.tsx b/apps/web/app/s/[videoId]/_components/VideoDownloadMenu.tsx
index a961cbc34..93a19ce6c 100644
--- a/apps/web/app/s/[videoId]/_components/VideoDownloadMenu.tsx
+++ b/apps/web/app/s/[videoId]/_components/VideoDownloadMenu.tsx
@@ -36,10 +36,12 @@ export function VideoDownloadMenu({
setIsDownloading(true);
const run = async () => {
- const { downloadUrl, filename } = await getVideoDownloadInfo(
- videoId,
- variant,
- );
+ const result = await getVideoDownloadInfo(videoId, variant);
+ if (!result.success) {
+ throw new Error(result.error);
+ }
+
+ const { downloadUrl, filename } = result;
const response = await fetch(downloadUrl);
if (!response.ok) throw new Error("Failed to download video");
const blob = await response.blob();