diff --git a/dictation_client/src/features/dictation/operations.ts b/dictation_client/src/features/dictation/operations.ts index 2cad273..522b6d9 100644 --- a/dictation_client/src/features/dictation/operations.ts +++ b/dictation_client/src/features/dictation/operations.ts @@ -565,10 +565,21 @@ export const backupTasksAsync = createAsyncThunk< a.click(); a.parentNode?.removeChild(a); - // eslint-disable-next-line no-await-in-loop - await tasksApi.backup(task.audioFileId, { - headers: { authorization: `Bearer ${accessToken}` }, - }); + // バックアップ済みに更新 + try { + // eslint-disable-next-line no-await-in-loop + await tasksApi.backup(task.audioFileId, { + headers: { authorization: `Bearer ${accessToken}` }, + }); + } catch (e) { + // e ⇒ errorObjectに変換 + const error = createErrorObject(e); + if (error.code === "E010603") { + // タスクが削除済みの場合は成功扱いとする + } else { + throw e; + } + } } } @@ -580,8 +591,22 @@ export const backupTasksAsync = createAsyncThunk< ); return {}; } catch (e) { - // e ⇒ errorObjectに変換" + // e ⇒ errorObjectに変換 const error = createErrorObject(e); + if (error.code === "E010603") { + // 存在しない音声ファイルをダウンロードしようとした場合 + thunkApi.dispatch( + openSnackbar({ + level: "error", + message: getTranslationID( + "dictationPage.message.fileAlreadyDeletedError" + ), + }) + ); + + return thunkApi.rejectWithValue({ error }); + } + thunkApi.dispatch( openSnackbar({ level: "error", diff --git a/dictation_client/src/translation/de.json b/dictation_client/src/translation/de.json index f72b729..5f65907 100644 --- a/dictation_client/src/translation/de.json +++ b/dictation_client/src/translation/de.json @@ -636,4 +636,4 @@ "lowerLayerId": "(de)Lower Layer ID" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/en.json b/dictation_client/src/translation/en.json index cc746f0..6d1eba5 100644 --- a/dictation_client/src/translation/en.json +++ b/dictation_client/src/translation/en.json @@ -636,4 +636,4 @@ "lowerLayerId": "Lower Layer ID" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/es.json b/dictation_client/src/translation/es.json index 94ec1e8..d0c183f 100644 --- a/dictation_client/src/translation/es.json +++ b/dictation_client/src/translation/es.json @@ -636,4 +636,4 @@ "lowerLayerId": "(es)Lower Layer ID" } } -} \ No newline at end of file +} diff --git a/dictation_client/src/translation/fr.json b/dictation_client/src/translation/fr.json index 4f6cf56..0e801cf 100644 --- a/dictation_client/src/translation/fr.json +++ b/dictation_client/src/translation/fr.json @@ -636,4 +636,4 @@ "lowerLayerId": "(fr)Lower Layer ID" } } -} \ No newline at end of file +}