エラーの詳細を表示するように

This commit is contained in:
kakkokari-gtyih 2024-11-14 16:38:51 +09:00
parent 8b998c32da
commit 0584571605
3 changed files with 31 additions and 3 deletions

8
locales/index.d.ts vendored
View file

@ -10414,6 +10414,14 @@ export interface Locale extends ILocale {
*
*/
"useAvatarAsStone": string;
/**
* Misskey Gamesをプレイする権限がありません
*/
"targetUserIsNotAvailable": string;
/**
*
*/
"targetIsYourself": string;
};
"_offlineScreen": {
/**

View file

@ -2769,6 +2769,8 @@ _reversi:
disallowIrregularRules: "変則なし"
showBoardLabels: "盤面に行・列番号を表示"
useAvatarAsStone: "石をアイコンにする"
targetUserIsNotAvailable: "相手のユーザーにはMisskey Gamesをプレイする権限がありません。"
targetIsYourself: "相手に自分自身を指定することはできません。"
_offlineScreen:
title: "オフライン - サーバーに接続できません"

View file

@ -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;