Skip to content
Permalink
Browse files

exit process when provider has error

  • Loading branch information...
khaihkd committed Jul 23, 2018
1 parent 5974a28 commit 7285d2ac95344bb3aae4e9c3b6486ed248fc2f77
Showing with 8 additions and 0 deletions.
  1. +8 −0 models/blockchain/chain.js
@@ -14,6 +14,14 @@ const config = require('config')
*/

const provider = new Web3.providers.WebsocketProvider(config.get('provider.ws'))
provider.connection.onerror(function (e) {
console.log('Provider error: ', e)
process.exit(1)
})
provider.connection.onclose(function (e) {
console.log('End provider: ', e)
proccess.exit(1)
})
const chain = new Web3(provider)

module.exports = chain

0 comments on commit 7285d2a

Please sign in to comment.
You can’t perform that action at this time.