added exception handling, updated client

This commit is contained in:
Tony Tam
2014-09-28 20:19:17 -07:00
parent 1eac80abdd
commit b0eff2d78b
6 changed files with 30 additions and 7 deletions

View File

@@ -673,6 +673,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
var obj = {
url: url,
method: this.method,
body: args.body,
useJQuery: this.useJQuery,
headers: headers,
on: {
@@ -1318,7 +1319,12 @@ ShredHttpClient.prototype.execute = function(obj) {
if(contentType != null) {
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if(response.content.data && response.content.data !== "")
out.obj = JSON.parse(response.content.data);
try{
out.obj = JSON.parse(response.content.data);
}
catch (e) {
// unable to parse
}
else
out.obj = {}
}