paddle-sdk
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="1.2.1"></a> | ||
## [1.2.1](https://github.com/avaly/paddle-sdk/compare/v1.2.0...v1.2.1) (2019-06-18) | ||
### Bug Fixes | ||
* Throw on error responses with 2xx status code ([28f07da](https://github.com/avaly/paddle-sdk/commit/28f07da)) | ||
<a name="1.2.0"></a> | ||
@@ -7,0 +17,0 @@ # [1.2.0](https://github.com/avaly/paddle-sdk/compare/v1.1.0...v1.2.0) (2018-03-23) |
{ | ||
"name": "paddle-sdk", | ||
"description": "The Paddle.com Node.js SDK", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"main": "sdk.js", | ||
@@ -12,2 +12,9 @@ "author": "Valentin Agachi <github-com@agachi.name>", | ||
"license": "MIT", | ||
"keywords": [ | ||
"paddle", | ||
"sdk", | ||
"api", | ||
"payments", | ||
"subscriptions" | ||
], | ||
"engines": { | ||
@@ -14,0 +21,0 @@ "node": ">=8.5.0" |
13
sdk.js
@@ -52,8 +52,13 @@ const crypto = require('crypto'); | ||
let result = body; | ||
if (result.success && result.response) { | ||
result = result.response; | ||
if (typeof body.success === 'boolean') { | ||
if (body.success) { | ||
return body.response || body; | ||
} | ||
throw new Error( | ||
`Request ${url} returned an error! response=${JSON.stringify(body)}` | ||
); | ||
} | ||
return result; | ||
return body; | ||
}); | ||
@@ -60,0 +65,0 @@ } |
16045
404