diff --git a/lib/js/ZCRMRestClient.js b/lib/js/ZCRMRestClient.js index cefbe21..7989dd2 100644 --- a/lib/js/ZCRMRestClient.js +++ b/lib/js/ZCRMRestClient.js @@ -138,7 +138,8 @@ var default_user_identifier = "zcrm_default_user"; ); } else{ - + console.log("Problem occured while generating access token from refresh token. Response : "+JSON.stringify(response)) + reject(resultObj) throw new Error("Problem occured while generating access token and refresh token from grant token.Response : "+JSON.stringify(response)); } }) @@ -335,4 +336,4 @@ ZCRMRestClient.parseAndConstructObject = function(response){ ZCRMRestClient.API = require('./crmapi'); - module.exports = ZCRMRestClient; \ No newline at end of file + module.exports = ZCRMRestClient; diff --git a/lib/js/util.js b/lib/js/util.js index 70a55f3..33f9004 100644 --- a/lib/js/util.js +++ b/lib/js/util.js @@ -112,6 +112,13 @@ function makeapicall(request){ if(error){ resolve(error); } + else if(!response){ + var respObj = { + "message" : "failed response", //No I18N + "status_code" : "204" //No I18N + } + resolve(JSON.stringify(respObj)); + } else if(response.statusCode == 204){ var respObj = { @@ -239,4 +246,4 @@ module.exports = { constructRequestDetails : constructRequestDetails, promiseResponse : promiseResponse, -} \ No newline at end of file +} diff --git a/package.json b/package.json index 426491a..0a1b728 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zcrmsdk", - "version": "0.0.20", + "version": "0.0.22", "description": "Node SDK for Zoho CRM", "main": "lib/js/ZCRMRestClient", "dependencies": {