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

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