diff --git a/src/rpc.js b/src/rpc.js index 50c427960c..962151fdbc 100644 --- a/src/rpc.js +++ b/src/rpc.js @@ -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 --git a/src/session.js b/src/session.js index 39059557cd..c49378f953 100644 --- a/src/session.js +++ b/src/session.js @@ -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();