Commit 56ce974c authored by Sebastien Robin's avatar Sebastien Robin

erp5_core: define what activity_watcher gadget should do when things are not working (part 2)

simplify error handling and avoid code duplication (thanks Romain for advices)
parent 65d893ea
...@@ -57,22 +57,17 @@ ...@@ -57,22 +57,17 @@
form_gadget.props.element.querySelector(".activity_watcher_gadget") form_gadget.props.element.querySelector(".activity_watcher_gadget")
.innerHTML = html_content; .innerHTML = html_content;
return RSVP.delay(1000); }, function (error) {
})
.push(function () {
return getDataExamine();
})
.push(undefined, function (error) {
//Exception is raised if network is lost for some reasons, //Exception is raised if network is lost for some reasons,
//in this case, try patiently until network is back. //in this case, try patiently until network is back.
//There is probably more clean ways console.log("Unable to fetch activities from ERP5", error);
console.log("error", error); })
return new RSVP.Queue().push(function () { .push(function () {
return RSVP.delay(1000); return RSVP.delay(1000);
}).push(function () { })
.push(function () {
return getDataExamine(); return getDataExamine();
}); });
});
} }
return queue.push(function () { return queue.push(function () {
return getDataExamine(); return getDataExamine();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment