Skip to content

Commit

Permalink
throw error when parsed value have error property
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Sep 3, 2015
1 parent 9a6a576 commit 4a40caf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bitcoind-rpc-client",
"version": "0.1.0",
"version": "0.1.1",
"description": "Bitcoind RPC client",
"keywords": [
"bitcoin",
Expand Down
4 changes: 4 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ export default class RpcClient extends Methods {

try {
let parsed = JSON.parse(data)
if (parsed.error) {
return reject(new Error(JSON.stringify(parsed.error)))
}

resolve(parsed)
} catch (err) {
reject(new Error(
Expand Down

0 comments on commit 4a40caf

Please sign in to comment.