Skip to content

Commit

Permalink
エラーの詳細を表示するように
Browse files Browse the repository at this point in the history
  • Loading branch information
kakkokari-gtyih committed Nov 14, 2024
1 parent 8b998c3 commit 0584571
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
8 changes: 8 additions & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10414,6 +10414,14 @@ export interface Locale extends ILocale {
* 石をアイコンにする
*/
"useAvatarAsStone": string;
/**
* 相手のユーザーにはMisskey Gamesをプレイする権限がありません。
*/
"targetUserIsNotAvailable": string;
/**
* 相手に自分自身を指定することはできません。
*/
"targetIsYourself": string;
};
"_offlineScreen": {
/**
Expand Down
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2769,6 +2769,8 @@ _reversi:
disallowIrregularRules: "変則なし"
showBoardLabels: "盤面に行・列番号を表示"
useAvatarAsStone: "石をアイコンにする"
targetUserIsNotAvailable: "相手のユーザーにはMisskey Gamesをプレイする権限がありません。"
targetIsYourself: "相手に自分自身を指定することはできません。"

_offlineScreen:
title: "オフライン - サーバーに接続できません"
Expand Down
24 changes: 21 additions & 3 deletions packages/frontend/src/pages/reversi/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,33 @@ async function matchHeatbeat() {
}

function onApiError(err) {
if (err.id === '7f86f06f-7e15-4057-8561-f4b6d4ac755a') {
if (err.id != null) {
let title: string | null = null;
let text = i18n.ts.somethingHappened;

switch (err.id) {
case '7f86f06f-7e15-4057-8561-f4b6d4ac755a':
title = i18n.ts.permissionDeniedError;
text = i18n.ts.permissionDeniedErrorDescription;
break;
case '3a8a677f-98e5-4c4d-b059-e5874b44bd4f':
title = i18n.ts.somethingHappened;
text = i18n.ts._reversi.targetUserIsNotAvailable;
break;
case '96fd7bd6-d2bc-426c-a865-d055dcd2828e':
title = i18n.ts.somethingHappened;
text = i18n.ts._reversi.targetIsYourself;
break;
}

// Role permission error
matchingUser.value = null;
matchingAny.value = false;

os.alert({
type: 'error',
title: i18n.ts.permissionDeniedError,
text: i18n.ts.permissionDeniedErrorDescription,
title: title ?? undefined,
text,
});
}
return null;
Expand Down

0 comments on commit 0584571

Please sign in to comment.