chargebee
Advanced tools
Comparing version 1.1.1 to 1.1.4
@@ -0,1 +1,27 @@ | ||
### v1.1.4 (2014-09-16) | ||
* * * | ||
No changes other than version update. | ||
### v1.1.3 (2014-09-16) | ||
* * * | ||
No changes other than version update. | ||
### v1.1.2 (2014-09-16) | ||
* * * | ||
**Error Model**: | ||
New simpler model for error handling has been implemented. Please see below api document for more details | ||
https://apidocs.chargebee.com/docs/api?lang=node#error_handling | ||
The following variables in the error object passed to the response have been deprecated. | ||
* error_code (Use api_error_code instead) | ||
* error_param (Use param instead) | ||
* error_msg (Use message instead). | ||
The changes are backward compatible. Ensure that your error handling code is tested after you upgrade to this version. | ||
### v1.1.1 (2014-08-13) | ||
@@ -2,0 +28,0 @@ * * * |
@@ -8,3 +8,3 @@ var ChargeBee = {}; | ||
timeout: 40000, | ||
clientVersion: 'v0.9.0', | ||
clientVersion: 'v1.1.4', | ||
port: 443 | ||
@@ -42,3 +42,3 @@ }; | ||
if (!ChargeBee._util.isFunction(callBack)) { | ||
throw new Error(('The callback parameter passed is incorrect.')); | ||
throw new Error('The callback parameter passed is incorrect.'); | ||
} | ||
@@ -65,4 +65,5 @@ return ChargeBee._core.makeApiRequest(env, callBack, this.apiCall.httpMethod, this.apiCall.urlPrefix, this.apiCall.urlSuffix, urlIdParam, params); | ||
req.abort(); | ||
throwError(callBack, 504, 'timeout', 'request aborted due to timeout.'); | ||
throwError(callBack,'io_error', 504, 'timeout', 'request aborted due to timeout.'); | ||
}; | ||
}; | ||
@@ -77,9 +78,10 @@ | ||
}); | ||
res.on('end', function() { | ||
res.on('end', function() { | ||
try { | ||
response = JSON.parse(response); | ||
} catch (e) { | ||
throwError(callBack, 500, 'invalid_json', 'invalid json from chargebee Api', e); | ||
throwError(callBack,'client_error', 500, 'invalid_json', 'invalid json in response. Probably not a ChargeBee response', e); | ||
} | ||
if (response.error_code) { | ||
if (res.statusCode < 200 || res.statusCode > 299) { | ||
response.http_status_code = res.statusCode; | ||
callBack(response, null); | ||
@@ -97,3 +99,3 @@ } else { | ||
return; | ||
throwError(callBack, 503, 'connection_error', 'connection error while making request.', error); | ||
throwError(callBack,'io_error', 503, 'connection_error', 'connection error while making request.', error); | ||
}; | ||
@@ -183,7 +185,11 @@ }; | ||
}; | ||
var throwError = function(callBack, httpStatusCode, errorCode, message, detail) { | ||
var throwError = function(callBack,type,httpStatusCode, errorCode, message, detail) { | ||
var error = { | ||
'message': message, | ||
'type':type, | ||
'api_error_code':errorCode, | ||
'http_status_code':httpStatusCode, | ||
'http_code': httpStatusCode, | ||
'error_code': errorCode, | ||
'message': message | ||
}; | ||
@@ -190,0 +196,0 @@ if (typeof detail !== "undefined") { |
{ | ||
"name" : "chargebee", | ||
"version" : "1.1.1", | ||
"version" : "1.1.4", | ||
"description" : "A library for integrating with ChargeBee.", | ||
@@ -5,0 +5,0 @@ "keywords" : ["payments","billing","subscription","chargebee"], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25625
816