diff options
dapp reload - fixed disconnect detection via polling
Diffstat (limited to 'app/scripts/lib/inpage-provider.js')
-rw-r--r-- | app/scripts/lib/inpage-provider.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index bcde333d0..c6bfdb4da 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -1,6 +1,6 @@ const Streams = require('mississippi') -const ObjectMultiplex = require('./obj-multiplex') const StreamProvider = require('web3-stream-provider') +const ObjectMultiplex = require('./obj-multiplex') const RemoteStore = require('./remote-store.js').RemoteStore module.exports = MetamaskInpageProvider @@ -11,8 +11,9 @@ function MetamaskInpageProvider (connectionStream) { // setup connectionStream multiplexing var multiStream = ObjectMultiplex() Streams.pipe(connectionStream, multiStream, connectionStream, function (err) { - console.warn('MetamaskInpageProvider - lost connection to MetaMask') - if (err) throw err + let warningMsg = 'MetamaskInpageProvider - lost connection to MetaMask' + if (err) warningMsg += '\n' + err.stack + console.warn(warningMsg) }) self.multiStream = multiStream @@ -20,16 +21,18 @@ function MetamaskInpageProvider (connectionStream) { var publicConfigStore = remoteStoreWithLocalStorageCache('MetaMask-Config') var storeStream = publicConfigStore.createStream() Streams.pipe(storeStream, multiStream.createStream('publicConfig'), storeStream, function (err) { - console.warn('MetamaskInpageProvider - lost connection to MetaMask publicConfig') - if (err) throw err + let warningMsg = 'MetamaskInpageProvider - lost connection to MetaMask publicConfig' + if (err) warningMsg += '\n' + err.stack + console.warn(warningMsg) }) self.publicConfigStore = publicConfigStore // connect to async provider var asyncProvider = new StreamProvider() Streams.pipe(asyncProvider, multiStream.createStream('provider'), asyncProvider, function (err) { - console.warn('MetamaskInpageProvider - lost connection to MetaMask provider') - if (err) throw err + let warningMsg = 'MetamaskInpageProvider - lost connection to MetaMask provider' + if (err) warningMsg += '\n' + err.stack + console.warn(warningMsg) }) asyncProvider.on('error', console.error.bind(console)) self.asyncProvider = asyncProvider |