0
0

enhance(client): show readable error when rate limit exceeded

This commit is contained in:
syuilo 2023-01-15 16:13:57 +09:00
parent e1159e9ef2
commit 92136272b0
3 changed files with 7 additions and 1 deletions

View File

@ -99,6 +99,7 @@ You should also include the user name that made the change.
- Client: Add link to user RSS feed in profile menu @ssmucny - Client: Add link to user RSS feed in profile menu @ssmucny
- Client: Compress non-animated PNG files @saschanaz - Client: Compress non-animated PNG files @saschanaz
- Client: YouTube window player @sim1222 - Client: YouTube window player @sim1222
- Client: show readable error when rate limit exceeded @syuilo
- Client: enhance dashboard of control panel @syuilo - Client: enhance dashboard of control panel @syuilo
- Client: Vite is upgraded to v4 @syuilo, @tamaina - Client: Vite is upgraded to v4 @syuilo, @tamaina
- Client: HMR is available while yarn dev @tamaina - Client: HMR is available while yarn dev @tamaina

View File

@ -933,6 +933,8 @@ unassign: "アサインを解除"
color: "色" color: "色"
manageCustomEmojis: "カスタム絵文字の管理" manageCustomEmojis: "カスタム絵文字の管理"
youCannotCreateAnymore: "これ以上作成することはできません。" youCannotCreateAnymore: "これ以上作成することはできません。"
cannotPerformTemporary: "一時的に利用できません"
cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。"
_role: _role:
new: "ロールの作成" new: "ロールの作成"

View File

@ -20,7 +20,10 @@ export const apiWithDialog = ((
promiseDialog(promise, null, (err) => { promiseDialog(promise, null, (err) => {
let title = null; let title = null;
let text = err.message + '\n' + (err as any).id; let text = err.message + '\n' + (err as any).id;
if (err.code.startsWith('TOO_MANY')) { if (err.code === 'RATE_LIMIT_EXCEEDED') {
title = i18n.ts.cannotPerformTemporary;
text = i18n.ts.cannotPerformTemporaryDescription;
} else if (err.code.startsWith('TOO_MANY')) {
title = i18n.ts.youCannotCreateAnymore; title = i18n.ts.youCannotCreateAnymore;
text = `${i18n.ts.error}: ${err.id}`; text = `${i18n.ts.error}: ${err.id}`;
} }