From 6991215b40dc4bc6090540e0dfe8d216b1d79b3e Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 15 Jun 2018 10:04:19 -0400 Subject: [PATCH] catch error and warn if no provider --- lib/modules/ens/embarkjs.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index 4b3ac948..1f37856c 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -261,14 +261,19 @@ __embarkENS.setProvider = function () { self.ens = new web3.eth.Contract(self.registryInterface, registryAddresses[id]); } // todo: deploy at this point - return undefined; - }); + }).catch(e => { + if (e.message.indexOf('Provider not set or invalid') > -1) { + console.warn('ENS is not available in this chain'); + return; + } + console.error(e); + }); }; __embarkENS.resolve = function(name) { const self = this; - if (self.ens === undefined) return undefined; + if (self.ens === undefined) return; let node = namehash.hash(name); @@ -283,7 +288,7 @@ __embarkENS.resolve = function(name) { __embarkENS.lookup = function(address) { const self = this; - if (self.ens === undefined) return undefined; + if (self.ens === undefined) return; if (address.startsWith("0x")) address = address.slice(2);