I am connecting to local node from browser like:
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
If there is no node running at localhost, I see an error in browser console:
Error: Invalid JSON RPC response: ""
Is there a way to catch this error and provide useful informations to the user? I have tried adding callbacks to new Web3()
and new HttpProvider()
calls, but none of them is firing.