Skip to content

Commit 0c1e973

Browse files
authored
Fix #536 Update error messages for 'caliper-cli' package (#1348)
* Update error messages for 'bind'/'unbind' command Signed-off-by: Tezas-6174 <jamdade.2@iitj.ac.in> * Update error messages for 'launch worker' command Signed-off-by: Tezas-6174 <jamdade.2@iitj.ac.in> * Update error messages for 'launch manager' command Signed-off-by: Tezas-6174 <jamdade.2@iitj.ac.in> * Update error message for 'launch' command Signed-off-by: Tezas-6174 <jamdade.2@iitj.ac.in> * Remove unnecessary debug logs Signed-off-by: Tezas-6174 <jamdade.2@iitj.ac.in>
1 parent e38c05a commit 0c1e973

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

packages/caliper-cli/caliper.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ let results = yargs
3838
.strict(false)
3939
.argv;
4040

41+
42+
4143
if (!results.thePromise) {
42-
Logger.error(`Unrecognised command: '${results._[0]}'`);
44+
Logger.error(`Command not recognised: '${results._[0]}'`);
4345
process.exit(1);
4446
}
4547

packages/caliper-cli/lib/launch/lib/launchManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ class LaunchManager {
6262
const response = await engine.run();
6363

6464
if (response === 0) {
65-
logger.info('Benchmark successfully finished');
65+
logger.info('Benchmark successfully finished!');
6666
} else {
6767
knownError = true;
68-
let msg = `Benchmark failed with error code ${response}`;
68+
let msg = `Benchmark execution failed with error code: ${response}`;
6969
logger.error(msg);
7070
throw new Error(msg);
7171
}

packages/caliper-cli/lib/launch/lib/launchWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class LaunchWorker {
4040

4141
if (bindingSpec) {
4242
if (CaliperUtils.isForkedProcess()) {
43-
logger.info('Worker is a locally forked process, skipping binding step already performed by the manager process');
43+
logger.info('Worker is a locally forked process, skipping the binding step, already performed by the manager process');
4444
}
4545
else {
4646
logger.info(`Binding specification is present, performing binding for "${bindingSpec}"`);

packages/caliper-cli/lib/launchCommand.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ module.exports.command = 'launch <subcommand>';
1818
module.exports.describe = 'Launch a Caliper process either in a manager or worker role.';
1919
module.exports.builder = yargs => {
2020
return yargs
21-
.demandCommand(1, 'Incorrect command. Please see the list of commands above, or enter "caliper launch --help".')
21+
.demandCommand(1, 'Command not found! Please check the list of commands given above, or try running "caliper launch --help".')
2222
.commandDir('./launch');
2323
};

packages/caliper-cli/lib/lib/bindCommon.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ class BindCommon {
4242

4343
let sutSpecParts = sutSpec.split(':');
4444
if (sutSpecParts.length < 1 || sutSpecParts.length > 2) {
45-
let msg = `SUT specification is expected in the <SUT type>:<SDK version> format, not as "${sutSpec}"`;
45+
let msg = `The expected SUT specification format is <SUT type>:<SDK version> format, not as "${sutSpec}"`;
4646
logger.error(msg);
4747
throw new Error(msg);
4848
}
4949

5050
let sut = sutSpecParts[0];
5151
let sdk = sutSpecParts[1];
5252
if (!sdk) {
53-
logger.warn('SUT SDK version is not specified, defaulting to "latest"');
53+
logger.warn('SUT SDK version is not specified, defaulting to the "latest" version');
5454
sdk = 'latest';
5555
}
5656

@@ -63,7 +63,7 @@ class BindCommon {
6363
// User has passed a configuration file to bind
6464
file = CaliperUtils.resolvePath(file);
6565
if (!fs.existsSync(file)) {
66-
let msg = `Passed custom configuration file "${file}" does not exist`;
66+
let msg = `The passed custom configuration file "${file}" does not exist`;
6767
logger.error(msg);
6868
throw new Error(msg);
6969
} else {
@@ -90,7 +90,7 @@ class BindCommon {
9090
}
9191

9292
if (!cwd) {
93-
logger.warn(`Working directory not specified. Using "${path.resolve('./')}"`);
93+
logger.warn(`Working directory is not specified. Current path: "${path.resolve('./')}"`);
9494
cwd = path.resolve('./');
9595
} else {
9696
cwd = path.resolve(cwd);
@@ -106,14 +106,15 @@ class BindCommon {
106106
// select the first matching setting, if any
107107
if (extraSpec.settings) {
108108
let nodeVersion;
109-
logger.info('Querying node version');
109+
logger.info('Querying node version...');
110110
try {
111111
nodeVersion = await CaliperUtils.getCommandOutput('node', ['-v']);
112112
} catch (e) {
113+
logger.error(`Node version not found! Version queried: ${nodeVersion}`);
113114
logger.error(e.message);
114115
throw e;
115116
}
116-
logger.info(`Detected node version ${nodeVersion}`);
117+
logger.info(`Detected node version: ${nodeVersion}`);
117118

118119
for (let setting of extraSpec.settings) {
119120
let regex = new RegExp(setting.versionRegexp, 'g');

0 commit comments

Comments
 (0)