Skip to content

Commit

Permalink
Fix #536 Update error messages for 'caliper-ethereum' package (#1363)
Browse files Browse the repository at this point in the history
* Update error messages for 'ethereum-connector'

Signed-off-by: Tezas-6174 <[email protected]>

* Fix and organize a few error messages

Signed-off-by: Tezas-6174 <[email protected]>

* fix a few bugs

Signed-off-by: Tezas-6174 <[email protected]>

* Fix an error message in ethereum-connector

Signed-off-by: Tezas-6174 <[email protected]>

* update a keyword in an error message

Signed-off-by: Tezas-6174 <[email protected]>
  • Loading branch information
0xt3j4s authored Jun 21, 2022
1 parent 7ca519b commit ae23774
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/caliper-ethereum/lib/ethereum-connector.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ class EthereumConnector extends ConnectorBase {
try {
if (privacy) {
contractInstance = await self.deployPrivateContract(contractData, privacy);
logger.info('Deployed private contract ' + contractData.name + ' at ' + contractInstance.options.address);
logger.info(`Deployed private contract ${contractData.name} at ${contractInstance.options.address}`);
} else {
contractInstance = await self.deployContract(contractData);
logger.info('Deployed contract ' + contractData.name + ' at ' + contractInstance.options.address);
logger.info(`Deployed contract ${contractData.name} at ${contractInstance.options.address}`);
}
} catch (err) {
reject(err);
Expand Down Expand Up @@ -244,7 +244,7 @@ class EthereumConnector extends ConnectorBase {

const onFailure = (err) => {
status.SetStatusFail();
logger.error('Failed tx on ' + request.contract + ' calling method ' + request.verb + ' nonce ' + params.nonce);
logger.error(`Failed tx on ${request.contract}; calling method: ${request.verb}; nonce: ${params.nonce}`);
logger.error(err);
};

Expand Down Expand Up @@ -302,7 +302,7 @@ class EthereumConnector extends ConnectorBase {

const onFailure = (err) => {
status.SetStatusFail();
logger.error('Failed private tx on ' + request.contract + ' calling method ' + request.verb + ' private nonce ' + 0);
logger.error(`Failed private tx on ${request.contract}; calling method: ${request.verb}; private nonce: ` + 0);
logger.error(err);
};

Expand Down Expand Up @@ -402,8 +402,9 @@ class EthereumConnector extends ConnectorBase {
if (txRcpt.status === '0x1') {
return new web3.eth.Contract(contractData.abi, txRcpt.contractAddress);
} else {
logger.error('Failed private transaction hash ' + txHash);
throw new Error('Failed private transaction hash ' + txHash);
const msg = `Failed private transaction hash ${txHash}`;
logger.error(msg);
throw new Error(msg);
}
} catch (err) {
logger.error('Error deploying private contract: ', JSON.stringify(err));
Expand Down Expand Up @@ -441,7 +442,7 @@ class EthereumConnector extends ConnectorBase {
return el.type === 'LEGACY';
})[0].privacyGroupId;
} else {
throw new Error('Multiple legacy privacy groups with same members. Can\'t resolve privacyGroupId.');
throw new Error('There are multiple legacy privacy groups with same members. Can\'t resolve privacyGroupId.');
}
}
case 'pantheon':
Expand Down

0 comments on commit ae23774

Please sign in to comment.