[FIX] core.js get_file method: correctly extract exception from body

bzr revid: sle@openerp.com-20140429132319-gfp2hlaj1qlatt50
This commit is contained in:
Simon Lejeune 2014-04-29 15:23:19 +02:00
commit 393c87120d
1 changed files with 5 additions and 8 deletions

View File

@ -460,14 +460,11 @@ instance.web.Session.include( /** @lends instance.web.Session# */{
.appendTo(document.body)
.load(function () {
try {
if (options.error) {
if (!this.contentDocument.body.childNodes[1]) {
options.error(this.contentDocument.body.childNodes);
}
else {
options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent));
}
}
if (options.error) {
var body = this.contentDocument.body;
var node = body.childNodes[1] || body.childNodes[0];
options.error(JSON.parse(node.textContent));
}
} finally {
complete();
}