diff options
| author | Maze Winther <mazewinther@gmail.com> | 2025-07-26 13:25:10 +0200 |
|---|---|---|
| committer | Maze Winther <mazewinther@gmail.com> | 2025-07-26 13:25:10 +0200 |
| commit | 906f95399d3a0119af0e57c2cb31fafbcdc31391 (patch) | |
| tree | 36fbf46c70096fff2f7ddb97d2b7ef19adb6e9b0 /apps/web/src/components | |
| parent | 14475dc9a692aeffa8ef3caccecc1d3164ce4cfc (diff) | |
| download | opencut-906f95399d3a0119af0e57c2cb31fafbcdc31391.tar.gz | |
refactor: better error handling
Diffstat (limited to 'apps/web/src/components')
| -rw-r--r-- | apps/web/src/components/editor/timeline/timeline-element.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/apps/web/src/components/editor/timeline/timeline-element.tsx b/apps/web/src/components/editor/timeline/timeline-element.tsx index c66e9fcb..f581bbf0 100644 --- a/apps/web/src/components/editor/timeline/timeline-element.tsx +++ b/apps/web/src/components/editor/timeline/timeline-element.tsx @@ -157,16 +157,16 @@ export function TimelineElement({ if (!file) return; try { - const success = await replaceElementMedia(track.id, element.id, file); - if (success) { + const result = await replaceElementMedia(track.id, element.id, file); + if (result.success) { toast.success("Clip replaced successfully"); } else { - toast.error("Failed to replace clip"); + toast.error(result.error || "Failed to replace clip"); } } catch (error) { - toast.error("Failed to replace clip"); - console.log( - JSON.stringify({ error: "Failed to replace clip", details: error }) + console.error("Unexpected error replacing clip:", error); + toast.error( + `Unexpected error: ${error instanceof Error ? error.message : "Unknown error"}` ); } }; |
