From 66c643677d4985b7836baab08ecbc7494d6ff2c5 Mon Sep 17 00:00:00 2001 From: "makabe.t" Date: Fri, 15 Mar 2024 06:53:41 +0000 Subject: [PATCH] =?UTF-8?q?Merged=20PR=20829:=20=E9=9F=B3=E5=A3=B0?= =?UTF-8?q?=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=83=90=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=82=A2=E3=83=83=E3=83=97=E3=83=9D=E3=83=83=E3=83=97=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 概要 [Task3882: 音声ファイルバックアップポップアップ修正](https://paruru.nds-tyo.co.jp:8443/tfs/ReciproCollection/fa4924a4-d079-4fab-9fb5-a9a11eb205f0/_workitems/edit/3882) - 音声ファイルバックアップ中にファイル削除された場合の処理を追加しました。 - ダウンロードで対象ファイルが削除されていた場合に特別なエラーとなるようにしています。 - タスクバックアップで対象ファイルが削除されていた場合でも成功となるようにしています。 ## レビューポイント - 対応するエラーは適切でしょうか? ## UIの変更 - [Task3882](https://ndstokyo.sharepoint.com/:i:/r/sites/Piranha/Shared%20Documents/General/OMDS/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88/Task3882/%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%89%8A%E9%99%A4%E6%B8%88%E3%81%BF.png?csf=1&web=1&e=1BKVh8) ## クエリの変更 - なし ## 動作確認状況 - ローカルで確認 - 行った修正がデグレを発生させていないことを確認できるか - 具体的にどのような確認をしたか - ダウンロード実行中にファイル削除 - backupAPIからタスク不在エラーを返却して成功するか確認 --- .../src/features/dictation/operations.ts | 35 ++++++++++++++++--- dictation_client/src/translation/de.json | 2 +- dictation_client/src/translation/en.json | 2 +- dictation_client/src/translation/es.json | 2 +- dictation_client/src/translation/fr.json | 2 +- 5 files changed, 34 insertions(+), 9 deletions(-) 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 +}