Merge pull request #894 from embark-framework/bugfix/error-ws-connection-error

Remove useless try on ws connect
This commit is contained in:
Iuri Matias 2018-09-22 09:24:26 -04:00 committed by GitHub
commit 94758a1ea4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 15 deletions

View File

@ -276,7 +276,7 @@ class ContractDeployer {
contract.error = error.message; contract.error = error.message;
self.events.emit("deploy:contract:error", contract); self.events.emit("deploy:contract:error", contract);
if (error.message && error.message.indexOf('replacement transaction underpriced')) { if (error.message && error.message.indexOf('replacement transaction underpriced')) {
self.logger.warn("replacement transaction underpriced: This warning typically means a transaction exactly like this one is still pending on the blockchain") self.logger.warn("replacement transaction underpriced: This warning typically means a transaction exactly like this one is still pending on the blockchain");
} }
return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message)); return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
} }

View File

@ -13,20 +13,25 @@ __embarkWhisperNewWeb3.setProvider = function (options) {
} }
// TODO: take into account type // TODO: take into account type
self.web3 = new Web3(new Web3.providers.WebsocketProvider("ws://" + provider, options.providerOptions)); self.web3 = new Web3(new Web3.providers.WebsocketProvider("ws://" + provider, options.providerOptions));
self.getWhisperVersion(function (err, version) { self.web3.currentProvider.on('connect', () => {
if (err) { self.getWhisperVersion(function (err, version) {
console.log("whisper not available"); if (err) {
} else if (version >= 5) { console.log("whisper not available");
self.web3.shh.newSymKey().then((id) => { } else if (version >= 5) {
self.symKeyID = id; self.web3.shh.newSymKey().then((id) => {
}); self.symKeyID = id;
self.web3.shh.newKeyPair().then((id) => { });
self.sig = id; self.web3.shh.newKeyPair().then((id) => {
}); self.sig = id;
} else { });
throw new Error("version of whisper not supported"); } else {
} throw new Error("version of whisper not supported");
self.whisperVersion = self.web3.version.whisper; }
self.whisperVersion = self.web3.version.whisper;
});
});
self.web3.currentProvider.on('error', () => {
console.log("whisper not available");
}); });
}; };