changeset c60a4c38e2af in sao:default
details: https://hg.tryton.org/sao?cmd=changeset;node=c60a4c38e2af
description:
Display nice user message on too many requests
issue8935
review276601002
diffstat:
src/rpc.js | 4 ++++
src/session.js | 8 ++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diffs (39 lines):
diff -r 0eafc9f09fd8 -r c60a4c38e2af src/rpc.js
--- a/src/rpc.js Mon Jan 20 11:31:16 2020 +0100
+++ b/src/rpc.js Tue Jan 21 00:34:55 2020 +0100
@@ -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();
diff -r 0eafc9f09fd8 -r c60a4c38e2af src/session.js
--- a/src/session.js Mon Jan 20 11:31:16 2020 +0100
+++ b/src/session.js Tue Jan 21 00:34:55 2020 +0100
@@ -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();