aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/inpage-provider.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2016-10-13 03:35:55 +0800
committerkumavis <aaron@kumavis.me>2016-10-13 03:35:55 +0800
commita1c3c944cf534fff8bfb9560347a03ba2a2bda00 (patch)
tree29888693645c9ad04f4b703f1fb0c0dfdac0da60 /app/scripts/lib/inpage-provider.js
parent0182f8a4e91b8a9b0951967d2c075955bfb4f24f (diff)
downloadtangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.tar.gz
tangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.tar.zst
tangerine-wallet-browser-a1c3c944cf534fff8bfb9560347a03ba2a2bda00.zip
dapp reload - fixed disconnect detection via polling
Diffstat (limited to 'app/scripts/lib/inpage-provider.js')
-rw-r--r--app/scripts/lib/inpage-provider.js17
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