Comparing version 1.2.0 to 1.3.0
@@ -22,11 +22,15 @@ /* Copyright 2011 Ask Bjørn Hansen, see LICENSE */ | ||
function() { | ||
var err = 200 == res.statusCode ? null : res.statusCode; | ||
var err = null; | ||
try { | ||
response = JSON.parse(response); | ||
if(200 != res.statusCode) { | ||
err = new Error(response.error.message); | ||
err.name = response.error.type; | ||
response = null; | ||
} | ||
} | ||
catch(e) { | ||
err = 1; | ||
response = { error : { message : "Invalid JSON from stripe.com" } }; | ||
err = new Error("Invalid JSON from stripe.com"); | ||
response = null; | ||
} | ||
err && (err = { statusCode: err, response: response }); | ||
callback(err, response); | ||
@@ -33,0 +37,0 @@ }); |
@@ -5,3 +5,3 @@ { | ||
"description": "Stripe API wrapper", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"homepage": "https://github.com/abh/node-stripe", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -20,3 +20,3 @@ # node-stripe | ||
if (err) { | ||
console.log("Couldn't create the customer record"); | ||
console.log(err.message); | ||
return; | ||
@@ -32,3 +32,3 @@ } | ||
All methods takes a callback as their last parameter. The callback is | ||
called with an error code (if any) and then the response. | ||
called with a Javascript `Error` (if any) and then the response. | ||
@@ -35,0 +35,0 @@ * `stripe.charges` - create, retrieve, refund and list charges |
Sorry, the diff of this file is not supported yet
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
33911
11
636
6