Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #536 Update error messages for 'caliper-cli' package #1348

Merged
merged 5 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/caliper-cli/caliper.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ let results = yargs
.strict(false)
.argv;



if (!results.thePromise) {
Logger.error(`Unrecognised command: '${results._[0]}'`);
// console.log(results._[0]);
0xt3j4s marked this conversation as resolved.
Show resolved Hide resolved
Logger.error(`Command not recognised: '${results._[0]}'`);
process.exit(1);
}

Expand Down
4 changes: 2 additions & 2 deletions packages/caliper-cli/lib/launch/lib/launchManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ class LaunchManager {
const response = await engine.run();

if (response === 0) {
logger.info('Benchmark successfully finished');
logger.info('Benchmark successfully finished!');
} else {
knownError = true;
let msg = `Benchmark failed with error code ${response}`;
let msg = `Benchmark execution failed with error code: ${response}`;
logger.error(msg);
throw new Error(msg);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-cli/lib/launch/lib/launchWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class LaunchWorker {

if (bindingSpec) {
if (CaliperUtils.isForkedProcess()) {
logger.info('Worker is a locally forked process, skipping binding step already performed by the manager process');
logger.info('Worker is a locally forked process, skipping the binding step, already performed by the manager process');
}
else {
logger.info(`Binding specification is present, performing binding for "${bindingSpec}"`);
Expand Down
2 changes: 1 addition & 1 deletion packages/caliper-cli/lib/launchCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ module.exports.command = 'launch <subcommand>';
module.exports.describe = 'Launch a Caliper process either in a manager or worker role.';
module.exports.builder = yargs => {
return yargs
.demandCommand(1, 'Incorrect command. Please see the list of commands above, or enter "caliper launch --help".')
.demandCommand(1, 'Command not found! Please check the list of commands given above, or try running "caliper launch --help".')
.commandDir('./launch');
};
13 changes: 7 additions & 6 deletions packages/caliper-cli/lib/lib/bindCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ class BindCommon {

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

let sut = sutSpecParts[0];
let sdk = sutSpecParts[1];
if (!sdk) {
logger.warn('SUT SDK version is not specified, defaulting to "latest"');
logger.warn('SUT SDK version is not specified, defaulting to the "latest" version');
sdk = 'latest';
}

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

if (!cwd) {
logger.warn(`Working directory not specified. Using "${path.resolve('./')}"`);
logger.warn(`Working directory is not specified. Current path: "${path.resolve('./')}"`);
cwd = path.resolve('./');
} else {
cwd = path.resolve(cwd);
Expand All @@ -106,14 +106,15 @@ class BindCommon {
// select the first matching setting, if any
if (extraSpec.settings) {
let nodeVersion;
logger.info('Querying node version');
logger.info('Querying node version...');
try {
nodeVersion = await CaliperUtils.getCommandOutput('node', ['-v']);
} catch (e) {
logger.error(`Node version not found! Version queried: ${nodeVersion}`);
logger.error(e.message);
throw e;
}
logger.info(`Detected node version ${nodeVersion}`);
logger.info(`Detected node version: ${nodeVersion}`);

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