From b86ae2e9f64324e2fcfc40d3c3b9316cec02eb4d Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Tue, 26 Jun 2018 14:56:23 -0500 Subject: [PATCH] fixup Signed-off-by: VoR0220 --- lib/modules/ens/embarkjs.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index d1819853..6979f865 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -153,6 +153,9 @@ __embarkENS.resolverInterface = [ } ]; +const NoDecodeAddrError = 'Error: Couldn\'t decode address from ABI: 0x'; +const NoDecodeStringError = 'ERROR: The returned value is not a convertible string: 0x0'; + __embarkENS.setProvider = function (config) { const self = this; EmbarkJS.onReady(() => { @@ -173,7 +176,7 @@ __embarkENS.resolve = function (name) { }).then((addr) => { return addr; }).catch((err) => { - if (err == 'Error: Couldn\'t decode address from ABI: 0x') { + if (err === NoDecodeAddrError) { console.log(name + " is not registered"); return "0x"; } @@ -196,7 +199,7 @@ __embarkENS.lookup = function (address) { let resolverContract = new EmbarkJS.Contract({abi: self.resolverInterface, address: resolverAddress}); return resolverContract.methods.name(node).call(); }).catch((err) => { - if (err == 'ERROR: The returned value is not a convertible string: 0x0' || err == 'Error: Couldn\'t decode address from ABI: 0x') { + if (err === NoDecodeStringError || err === NoDecodeAddrError) { console.log('Address does not resolve to name. Try syncing chain.'); return ""; }