mirror of https://github.com/apache/cloudstack.git
bug 5482: Fixed malformed JSON when an error is returned by the API call. Also fixed the UI to make use of the new JSON object.
This commit is contained in:
parent
3992d122ff
commit
68d5c0919a
|
|
@ -64,7 +64,7 @@ public class ApiResponseSerializer {
|
|||
} else if (result instanceof SuccessResponse) {
|
||||
sb.append("{ \"success\" : \""+((SuccessResponse)result).getSuccess()+"\"} ");
|
||||
} else if (result instanceof ExceptionResponse) {
|
||||
sb.append("{\"errorcode\" : \""+((ExceptionResponse)result).getErrorCode() + ", \"errortext\" : \""+ ((ExceptionResponse)result).getErrorText() +"\"} ");
|
||||
sb.append("{\"errorcode\" : "+((ExceptionResponse)result).getErrorCode() + ", \"errortext\" : \""+ ((ExceptionResponse)result).getErrorText() +"\"} ");
|
||||
}else {
|
||||
String jsonStr = gson.toJson(result);
|
||||
if ((jsonStr != null) && !"".equals(jsonStr)) {
|
||||
|
|
|
|||
|
|
@ -1073,10 +1073,11 @@ function handleErrorInDialog2(errorMsg, $thisDialog) {
|
|||
}
|
||||
|
||||
function parseXMLHttpResponse(XMLHttpResponse) {
|
||||
var start = XMLHttpResponse.responseText.indexOf("h1") + 3;
|
||||
var end = XMLHttpResponse.responseText.indexOf("</h1");
|
||||
var errorMsg = XMLHttpResponse.responseText.substring(start, end);
|
||||
return fromdb(errorMsg);
|
||||
var property;
|
||||
var json = jQuery.parseJSON(XMLHttpResponse.responseText);
|
||||
for(property in json) {}
|
||||
var errorObj = json[property];
|
||||
return fromdb(errorObj.errortext);
|
||||
}
|
||||
|
||||
function showLeftNavigationBasedOnRole() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue