catch error and warn if no provider
This commit is contained in:
parent
fd1b9d80f9
commit
6991215b40
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue