add helpful messages when ens register is rejected

This commit is contained in:
Jonathan Rainville 2018-10-05 11:08:33 -04:00 committed by Pascal Precht
parent 623bdc50ae
commit 6b4321874b
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
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 // Register function generated by the index
registerSubDomain(this.ens, this.registrar, this.resolver, web3.eth.defaultAccount, name, this.registration.rootDomain, 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 () { __embarkENS.isAvailable = function () {

View File

@ -323,8 +323,10 @@ class ENS {
next(); next();
}) })
.catch(err => { .catch(err => {
console.error('Error while registering the root domain'); self.logger.error('Error while registering the root domain');
console.error(err); 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); next(err);
}); });
}); });