json-rpc error handling (#128)

* json-rpc error handling

* partial revert
This commit is contained in:
Fabio Cigliano 2018-06-16 22:55:58 +12:00 committed by Josh Harvey
parent c3535e6ed3
commit 82726fd9c1
2 changed files with 39 additions and 16 deletions

18
dev/json-rpc.js Normal file
View file

@ -0,0 +1,18 @@
const rpc = require('../lib/plugins/common/json-rpc')
const account = {
username: 'test',
password: 'test'
}
const method = {}
const params = {
url: 'https://httpstat.us/500'
// url: 'https://httpstat.us/400'
// url: 'https://httpstat.us/200'
}
rpc.fetch(account, method, params)
.then(res => console.log('got result', res))
.catch(err => console.error('gor error', err))