add helpful messages when ens register is rejected

This commit is contained in:
Jonathan Rainville 2018-10-05 11:08:33 -04:00
parent b01793e9b7
commit ec1382e838
2 changed files with 10 additions and 3 deletions

View File

@ -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 () {

View File

@ -295,8 +295,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);
});
});