mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-26 15:54:55 +01:00
- Fix save errors when the resturned value is a HTML and not a JSON object.
This commit is contained in:
parent
e1d4f0afc8
commit
000b6a693d
@ -47,11 +47,15 @@ mindplot.RESTPersistenceManager = new Class({
|
|||||||
onFailure:function (xhr) {
|
onFailure:function (xhr) {
|
||||||
var responseText = xhr.responseText;
|
var responseText = xhr.responseText;
|
||||||
var error = null;
|
var error = null;
|
||||||
|
|
||||||
|
var contentType = this.getHeader("Content-Type");
|
||||||
|
if (contentType != null && contentType.indexOf("application/json") != -1) {
|
||||||
try {
|
try {
|
||||||
error = JSON.decode(responseText);
|
error = JSON.decode(responseText);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw "Unexpected error saving. Error response is not json object:" + responseText;
|
throw "Unexpected error saving. Error response is not json object:" + responseText;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
events.onError(error);
|
events.onError(error);
|
||||||
},
|
},
|
||||||
headers:{"Content-Type":"application/json", "Accept":"application/json"},
|
headers:{"Content-Type":"application/json", "Accept":"application/json"},
|
||||||
|
Loading…
Reference in New Issue
Block a user