Skip to content
Snippets Groups Projects
Commit 662abbb9 authored by vkovtun's avatar vkovtun
Browse files

BIS-753: Improved error messages, when the status code from the server is not successful.

parent 663c3264
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
......@@ -77,14 +77,16 @@ _DataStoreServerInternal.prototype.sendHttpRequest = function(httpMethod, conten
}
}
} else if (status >= 400 && status < 600) {
if (response.size > 0) {
response.text().then((blobResponse) => reject(new Error(JSON.parse(blobResponse).error[1].message)))
.catch((error) => reject(error));
} else {
reject(new Error(xhr.statusText));
}
} else {
reject(new Error("ERROR: " + xhr.responseText));
response.text().then((textResponse) => {
try {
const errorMessage = JSON.parse(textResponse).error[1].message;
reject(new Error(errorMessage));
} catch (e) {
reject(new Error(textResponse || xhr.statusText));
}
}).catch(() => {
reject(new Error("HTTP Error: " + status));
});
}
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment