Commit 6d76557c authored by Roque's avatar Roque

erp5_officejs: handle offline error when synchronizing

parent e9831033
......@@ -72,19 +72,27 @@
.declareAcquiredMethod("getSetting", "getSetting")
.declareAcquiredMethod("setSetting", "setSetting")
.declareAcquiredMethod("reload", "reload")
.declareAcquiredMethod("notifySubmitted", "notifySubmitted")
.declareService(function () {
var gadget = this;
if (gadget.state.auto_repair) {
return repair_and_redirect(gadget)
.push(undefined, function (e) {
if (e.name === "ReplicateReport") {
throw new Error(e.toString());
}
throw e;
});
}
return RSVP.Queue()
.push(function () {
if (gadget.state.auto_repair) {
return repair_and_redirect(gadget);
}
})
.push(undefined, function (error) {
console.log(error);
if (error && error.target && error.target.status === 0) {
return gadget.notifySubmitted({
message: "Error: cant't sync while offline",
status: "error"
});
}
throw error;
});
});
}(window, RSVP, rJS));
\ No newline at end of file
......@@ -242,7 +242,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>969.42224.7621.358</string> </value>
<value> <string>978.63074.34178.45346</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>1534757989.87</float>
<float>1570464833.09</float>
<string>UTC</string>
</tuple>
</state>
......
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