summaryrefslogtreecommitdiff
path: root/addons/web
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-18 18:53:56 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-18 18:53:56 +0200
commitcabe0951af2e0a0fcad47fa7a9fe2ffa5e8701cf (patch)
tree4932769edceb7c93eeb15ded48937acaea5bb046 /addons/web
parenta1a03792b6fb7a029a805976512f13ed13c2c6b9 (diff)
parent9001a75f23c014e744fc1853190297eed4c47438 (diff)
[MERGE] forward port branch 10.0 up to 9001a75f23c
Diffstat (limited to 'addons/web')
-rw-r--r--addons/web/static/src/js/framework/ajax.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/addons/web/static/src/js/framework/ajax.js b/addons/web/static/src/js/framework/ajax.js
index e74ae67dc04..d6241974d79 100644
--- a/addons/web/static/src/js/framework/ajax.js
+++ b/addons/web/static/src/js/framework/ajax.js
@@ -252,12 +252,20 @@ function get_file(options) {
if (options.error) {
var body = this.contentDocument.body;
var nodes = body.children.length === 0 ? body.childNodes : body.children;
- options.error({
- message: nodes.length > 1 ? nodes[1].textContent : '',
- data: {
- title: nodes.length > 0 ? nodes[0].textContent : '',
- },
- });
+ var errorParams = {};
+
+ try { // Case of a serialized Odoo Exception: It is Json Parsable
+ var node = nodes[1] || nodes[0];
+ errorParams = JSON.parse(node.textContent);
+ } catch (e) { // Arbitrary uncaught python side exception
+ errorParams = {
+ message: nodes.length > 1 ? nodes[1].textContent : '',
+ data: {
+ title: nodes.length > 0 ? nodes[0].textContent : '',
+ }
+ }
+ }
+ options.error(errorParams);
}
} finally {
complete();