Update error messages displayed

This commit is contained in:
Marcel Joubert 2024-09-05 10:49:55 +02:00
parent 33427daa0e
commit 970b14c409
2 changed files with 4 additions and 2 deletions

View File

@ -307,14 +307,14 @@ const handler = async function (argv) {
const collectionPath = collectionDir ? path.resolve(collectionDir) : process.cwd();
if (collectionDir && !fs.existsSync(collectionPath)) {
console.error(chalk.red(`The specified collection directory does not exist: ${collectionPath}`));
console.error(chalk.red(`Could not find the specified collection directory: ${collectionPath}`));
process.exit(constants.EXIT_STATUS.ERROR_COLLECTION_DIR_NOT_FOUND);
}
const brunoJsonPath = path.join(collectionPath, 'bruno.json');
const brunoJsonExists = await exists(brunoJsonPath);
if (!brunoJsonExists) {
console.error(chalk.red(`You can run only at the root of a collection`));
console.error(chalk.red(`Please navigate into the root directory or specify using --dir`));
process.exit(constants.EXIT_STATUS.ERROR_NOT_IN_COLLECTION);
}

View File

@ -23,6 +23,8 @@ const EXIT_STATUS = {
ERROR_INCORRECT_ENV_OVERRIDE: 8,
// Invalid output format requested
ERROR_INCORRECT_OUTPUT_FORMAT: 9,
// Invalid directory specified, specified directory does not contain bruno.json file
ERROR_COLLECTION_DIR_NOT_FOUND: 10,
// Everything else
ERROR_GENERIC: 255,
};