Commit b9233766 authored by Tristan Cavelier's avatar Tristan Cavelier

erp5storage.js answer formating modified

parent e97c2824
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
// XXX docstring // XXX docstring
function formatGetSuccessAnswer(answer) { function formatGetSuccessAnswer(answer) {
if (!answer) { return answer; } if (answer === undefined || answer === null) { throw answer; }
var result; var result;
if (typeof answer.data === "object" && answer.data) { if (typeof answer.data === "object" && answer.data) {
return answer; return answer;
...@@ -79,11 +79,10 @@ ...@@ -79,11 +79,10 @@
// XXX docstring // XXX docstring
function formatUpdateSuccessAnswer(answer) { function formatUpdateSuccessAnswer(answer) {
if (!answer) { return; } if (answer === undefined || answer === null) { throw answer; }
var result; var result;
if (answer.target && if (typeof answer.target === "object" && answer.target !== null &&
typeof answer.target.status === "number" && typeof answer.target.status === "number") {
typeof answer.target.statusText === "string") {
result = { result = {
"status": answer.target.status "status": answer.target.status
}; };
...@@ -94,7 +93,7 @@ ...@@ -94,7 +93,7 @@
// XXX docstring // XXX docstring
function formatErrorAnswer(answer) { function formatErrorAnswer(answer) {
if (!answer) { return; } if (answer === undefined || answer === null) { throw answer; }
var result, dom; var result, dom;
if (answer.target && if (answer.target &&
typeof answer.target.status === "number" && typeof answer.target.status === "number" &&
......
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