From 970b14c409991f010ddea14222d4baa369025706 Mon Sep 17 00:00:00 2001 From: Marcel Joubert Date: Thu, 5 Sep 2024 10:49:55 +0200 Subject: [PATCH] Update error messages displayed --- packages/bruno-cli/src/commands/run.js | 4 ++-- packages/bruno-cli/src/constants.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/bruno-cli/src/commands/run.js b/packages/bruno-cli/src/commands/run.js index 849aca875..e8104b77c 100644 --- a/packages/bruno-cli/src/commands/run.js +++ b/packages/bruno-cli/src/commands/run.js @@ -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); } diff --git a/packages/bruno-cli/src/constants.js b/packages/bruno-cli/src/constants.js index 6d0f877d7..6bf0582fc 100644 --- a/packages/bruno-cli/src/constants.js +++ b/packages/bruno-cli/src/constants.js @@ -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, };