about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-09-06 05:25:56 +0100
committerGitHub <noreply@github.com>2024-09-05 21:25:56 -0700
commit55468595d0dc5f55b9ef58400324832d811ec5d6 (patch)
tree1b66fbbff97fe810e54ffa861f0b1fa6cf62046d /src/state/queries
parent18133483fe679808671f6d31011594e57fe9a002 (diff)
downloadvoidsky-55468595d0dc5f55b9ef58400324832d811ec5d6.tar.zst
[Video] Error banner improvements (#5163)
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/video/video.ts13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/state/queries/video/video.ts b/src/state/queries/video/video.ts
index 4546595e7..06331c886 100644
--- a/src/state/queries/video/video.ts
+++ b/src/state/queries/video/video.ts
@@ -5,6 +5,7 @@ import {msg} from '@lingui/macro'
 import {useLingui} from '@lingui/react'
 import {QueryClient, useQuery, useQueryClient} from '@tanstack/react-query'
 
+import {AbortError} from '#/lib/async/cancelable'
 import {SUPPORTED_MIME_TYPES, SupportedMimeTypes} from '#/lib/constants'
 import {logger} from '#/logger'
 import {isWeb} from '#/platform/detection'
@@ -39,6 +40,8 @@ export interface State {
   pendingPublish?: {blobRef: BlobRef; mutableProcessed: boolean}
 }
 
+export type VideoUploadDispatch = (action: Action) => void
+
 function reducer(queryClient: QueryClient) {
   return (state: State, action: Action): State => {
     let updatedState = state
@@ -144,8 +147,9 @@ export function useUploadVideo({
       setJobId(response.jobId)
     },
     onError: e => {
-      logger.error('Error uploading video', {safeMessage: e})
-      if (e instanceof ServerError) {
+      if (e instanceof AbortError) {
+        return
+      } else if (e instanceof ServerError) {
         dispatch({
           type: 'SetError',
           error: e.message,
@@ -176,8 +180,9 @@ export function useUploadVideo({
       onVideoCompressed(video)
     },
     onError: e => {
-      logger.error('Error uploading video', {safeMessage: e})
-      if (e instanceof VideoTooLargeError) {
+      if (e instanceof AbortError) {
+        return
+      } else if (e instanceof VideoTooLargeError) {
         dispatch({
           type: 'SetError',
           error: _(msg`The selected video is larger than 100MB.`),