improve some deployment error messages

This commit is contained in:
Iuri Matias 2018-09-21 17:52:32 -04:00
parent 4af9114681
commit 3b6251eeb1
1 changed files with 4 additions and 2 deletions

View File

@ -245,7 +245,7 @@ class ContractDeployer {
deployObject = self.blockchain.deployContractObject(contractObject, {arguments: contractParams, data: dataCode});
} catch(e) {
if (e.message.indexOf('Invalid number of parameters for "undefined"') >= 0) {
return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className)));
return next(new Error(__("attempted to deploy %s without specifying parameters", contract.className)) + ". " + __("check if there are any params defined for this contract in this environment in the contracts configuration file"));
}
return next(new Error(e));
}
@ -267,7 +267,6 @@ class ContractDeployer {
let estimatedCost = contract.gas * contract.gasPrice;
self.logFunction(contract)(__("deploying") + " " + contract.className.bold.cyan + " " + __("with").green + " " + contract.gas + " " + __("gas at the price of").green + " " + contract.gasPrice + " " + __("Wei, estimated cost:").green + " " + estimatedCost + " Wei".green);
self.blockchain.deployContractFromObject(deployObject, {
from: contract.deploymentAccount,
gas: contract.gas,
@ -276,6 +275,9 @@ class ContractDeployer {
if (error) {
contract.error = error.message;
self.events.emit("deploy:contract:error", contract);
if (error.message && error.message.indexOf('replacement transaction underpriced')) {
self.logger.warn("replacement transaction underpriced: This warning typically means a transaction exactly like this one is still pending on the blockchain")
}
return next(new Error("error deploying =" + contract.className + "= due to error: " + error.message));
}
self.logFunction(contract)(contract.className.bold.cyan + " " + __("deployed at").green + " " + receipt.contractAddress.bold.cyan + " " + __("using").green + " " + receipt.gasUsed + " " + __("gas").green);