From 6b4321874b908cb45ac45a2928a34e6052856f67 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Fri, 5 Oct 2018 11:08:33 -0400 Subject: [PATCH] add helpful messages when ens register is rejected --- lib/modules/ens/embarkjs.js | 7 ++++++- lib/modules/ens/index.js | 6 ++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/modules/ens/embarkjs.js b/lib/modules/ens/embarkjs.js index 6663f023..f3dabedb 100644 --- a/lib/modules/ens/embarkjs.js +++ b/lib/modules/ens/embarkjs.js @@ -252,7 +252,12 @@ __embarkENS.registerSubDomain = function (name, address, callback) { // Register function generated by the index registerSubDomain(this.ens, this.registrar, this.resolver, web3.eth.defaultAccount, name, this.registration.rootDomain, - web3.utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix), address, console, EmbarkJS.Utils.secureSend, callback); + web3.utils.soliditySha3(address.toLowerCase().substr(2) + reverseAddrSuffix), address, console, EmbarkJS.Utils.secureSend, (err, result) => { + if (err && err.indexOf('Transaction has been reverted by the EVM') > -1) { + return callback('Registration was rejected. Are you the owner of the root domain?'); + } + callback(err, result); + }); }; __embarkENS.isAvailable = function () { diff --git a/lib/modules/ens/index.js b/lib/modules/ens/index.js index 0d249dc9..70c1286a 100644 --- a/lib/modules/ens/index.js +++ b/lib/modules/ens/index.js @@ -323,8 +323,10 @@ class ENS { next(); }) .catch(err => { - console.error('Error while registering the root domain'); - console.error(err); + self.logger.error('Error while registering the root domain'); + if (err.message.indexOf('Transaction has been reverted by the EVM') > -1) { + return next(__('Registration was rejected. Did you change the deployment account? If so, delete chains.json')); + } next(err); }); });