Display nice user message on too many requests

issue8935
review276601002
This commit is contained in:
Cédric Krier committed 2020-01-21 00:34:55 +01:00
1 parent 1e1da5f2a5
commit 1be481f75d
2 files changed
+12

No files matched your search

+4
View File
@@ -122,6 +122,10 @@
Sao.rpc(args, session).then(dfd.resolve, dfd.reject);
}, dfd.reject);
return;
} else if (query.status == 429) {
Sao.common.message.run(
Sao.i18n.gettext('Too many requests. Try again later.'),
'tryton-error').always(dfd.reject);
} else {
Sao.common.error.run(status_, error);
dfd.reject();
+8
View File
@@ -295,6 +295,10 @@
} else if (data.error) {
if (data.error[0].startsWith('401')) {
return this.run({}).then(dfd.resolve, dfd.reject);
} else if (data.error[0].startsWith('429')) {
Sao.common.message.run(
Sao.i18n.gettext('Too many requests. Try again later.'),
'tryton-error').always(dfd.resolve);
} else if (data.error[0].startsWith('404')) {
dfd.reject();
} else if (data.error[0] != 'LoginException') {
@@ -319,6 +323,10 @@
if (query.status == 401) {
// Retry
this.run({}).then(dfd.resolve, dfd.reject);
} else if (query.status == 429) {
Sao.common.message.run(
Sao.i18n.gettext('Too many requests. Try again later.'),
'tryton-error').always(dfd.resolve);
} else {
Sao.common.error.run(status_, error);
dfd.reject();