summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-01-15 16:13:57 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-01-15 16:13:57 +0900
commit92136272b09ef83b7779d7f10dac822b193e9fbd (patch)
tree7ec5657eadf791ca78f630533fb6ef516eddbdab
parentUpdate actions/checkout (#9587) (diff)
downloadmisskey-92136272b09ef83b7779d7f10dac822b193e9fbd.tar.gz
misskey-92136272b09ef83b7779d7f10dac822b193e9fbd.tar.bz2
misskey-92136272b09ef83b7779d7f10dac822b193e9fbd.zip
enhance(client): show readable error when rate limit exceeded
-rw-r--r--CHANGELOG.md1
-rw-r--r--locales/ja-JP.yml2
-rw-r--r--packages/frontend/src/os.ts5
3 files changed, 7 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee25c76724..06c9ee11e1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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: Compress non-animated PNG files @saschanaz
- Client: YouTube window player @sim1222
+- Client: show readable error when rate limit exceeded @syuilo
- Client: enhance dashboard of control panel @syuilo
- Client: Vite is upgraded to v4 @syuilo, @tamaina
- Client: HMR is available while yarn dev @tamaina
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index 67464e943d..ea3cc6c9e7 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -933,6 +933,8 @@ unassign: "アサインを解除"
color: "色"
manageCustomEmojis: "カスタム絵文字の管理"
youCannotCreateAnymore: "これ以上作成することはできません。"
+cannotPerformTemporary: "一時的に利用できません"
+cannotPerformTemporaryDescription: "操作回数が制限を超過するため一時的に利用できません。しばらく時間を置いてから再度お試しください。"
_role:
new: "ロールの作成"
diff --git a/packages/frontend/src/os.ts b/packages/frontend/src/os.ts
index 891d598d89..3c44ed6eaa 100644
--- a/packages/frontend/src/os.ts
+++ b/packages/frontend/src/os.ts
@@ -20,7 +20,10 @@ export const apiWithDialog = ((
promiseDialog(promise, null, (err) => {
let title = null;
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;
text = `${i18n.ts.error}: ${err.id}`;
}