don't crash and instead inform user if contract cannot be profiled

This commit is contained in:
Iuri Matias 2018-06-12 13:24:21 -04:00
parent a601541bb0
commit 1dcd30b3a8
1 changed files with 8 additions and 4 deletions

View File

@ -53,10 +53,14 @@ class Profiler {
let cmdName = cmd.split(' ')[0]; let cmdName = cmd.split(' ')[0];
let contractName = cmd.split(' ')[1]; let contractName = cmd.split(' ')[1];
if (cmdName === 'profile') { if (cmdName === 'profile') {
self.events.request('contracts:contract', contractName, (contract) => { self.events.request('contracts:contract', contractName, (contract) => {
self.logger.info("-- profile for " + contractName); if (!contract.deployedAddress) {
this.profile(contractName, contract); self.logger.info("-- couldn't profile " + contractName + " - it's not deployed or could be an interface");
}); return "";
}
self.logger.info("-- profile for " + contractName);
this.profile(contractName, contract);
});
return ""; return "";
} }
return false; return false;