Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

error handling for export

ameer246862b5a49e81f6
diff --git a/apps/desktop/src/routes/editor/ExportDialog.tsx b/apps/desktop/src/routes/editor/ExportDialog.tsx
index a677c6d3e..6fba44c78 100644
--- a/apps/desktop/src/routes/editor/ExportDialog.tsx
+++ b/apps/desktop/src/routes/editor/ExportDialog.tsx
@@ -1,6 +1,10 @@
import { Button } from "@cap/ui-solid";
+import { Select as KSelect } from "@kobalte/core/select";
+import { createMutation } from "@tanstack/solid-query";
+import { Channel } from "@tauri-apps/api/core";
+import { save } from "@tauri-apps/plugin-dialog";
+import { cx } from "cva";
import {
- createEffect,
createResource,
createSignal,
For,
@@ -8,11 +12,6 @@ import {
Show,
ValidComponent,
} from "solid-js";
-import { Select as KSelect } from "@kobalte/core/select";
-import { createMutation } from "@tanstack/solid-query";
-import { Channel } from "@tauri-apps/api/core";
-import { save } from "@tauri-apps/plugin-dialog";
-import { cx } from "cva";
import { createStore, produce } from "solid-js/store";
import Tooltip from "~/components/Tooltip";
@@ -20,13 +19,12 @@ import { authStore } from "~/store";
import { trackEvent } from "~/utils/analytics";
import { commands, events, RenderProgress } from "~/utils/tauri";
import { useEditorContext } from "./context";
-import { RESOLUTION_OPTIONS, ResolutionOption } from "./Header";
+import { RESOLUTION_OPTIONS } from "./Header";
import {
DialogContent,
MenuItem,
MenuItemList,
PopperContent,
- topLeftAnimateClasses,
topSlideAnimateClasses,
} from "./ui";
@@ -167,6 +165,12 @@ const ExportDialog = () => {
throw error;
}
},
+ onError: (error) => {
+ commands.globalMessageDialog(
+ error instanceof Error ? error.message : "Failed to copy recording"
+ );
+ setCopyState({ type: "idle" });
+ },
onSuccess() {
setCopyState({
type: "copied",
@@ -255,6 +259,12 @@ const ExportDialog = () => {
throw error;
}
},
+ onError: (error) => {
+ commands.globalMessageDialog(
+ error instanceof Error ? error.message : "Failed to export recording"
+ );
+ setExportState({ type: "idle" });
+ },
onSettled() {
setTimeout(() => {
exportWithSettings.reset();
@@ -393,6 +403,7 @@ const ExportDialog = () => {
commands.globalMessageDialog(
error instanceof Error ? error.message : "Failed to upload recording"
);
+ setUploadState({ type: "idle" });
},
onSettled() {
uploadVideo.reset();