mirror of
https://github.com/Kong/insomnia.git
synced 2026-04-23 15:49:42 -04:00
feat(Inso CLI): Improve error messages when Inso cannot find Insomnia data or global environments (#8942)
* improve inso error messages for no insomnia data or missing global environment * Update nesting in log message
This commit is contained in:
@@ -562,7 +562,14 @@ export const go = (args?: string[]) => {
|
||||
env => matchIdIsh(env, options.globals) || env.name === options.globals,
|
||||
);
|
||||
if (!globalEnv) {
|
||||
logger.warn('No global environment found with id or name', options.globals);
|
||||
logger.warn(
|
||||
`Error: No global environment found with ID or name "${options.globals}".
|
||||
TIP: If you're running "inso" inside a Git project, specify the path to the Insomnia YAML file containing the global environment using the "--globals" option.
|
||||
|
||||
Example:
|
||||
$ inso run collection --globals /path/to/global-environment.yaml
|
||||
`,
|
||||
);
|
||||
return process.exit(1);
|
||||
}
|
||||
if (globalEnv) {
|
||||
@@ -897,11 +904,10 @@ export const go = (args?: string[]) => {
|
||||
program.parseAsync(scriptArgs).catch(logErrorAndExit);
|
||||
});
|
||||
|
||||
program.command('generate-docs')
|
||||
.action(() => {
|
||||
generateDocumentation(program);
|
||||
return process.exit(1);
|
||||
});
|
||||
program.command('generate-docs').action(() => {
|
||||
generateDocumentation(program);
|
||||
return process.exit(1);
|
||||
});
|
||||
|
||||
program.parseAsync(args || process.argv).catch(logErrorAndExit);
|
||||
};
|
||||
|
||||
@@ -90,9 +90,23 @@ export const loadDb = async ({ pathToSearch, filterTypes }: Options) => {
|
||||
}
|
||||
|
||||
logger.warn(
|
||||
`No git, app data store or Insomnia V4 export file found at path "${pathToSearch}",
|
||||
--workingDir/-w should point to a git repository root, an Insomnia export file or a directory containing Insomnia data.
|
||||
re-run with --verbose to see tracing information`,
|
||||
`Error: No data source found at path "${pathToSearch}".
|
||||
TIP: Use "--workingDir/-w" to specify one of the following:
|
||||
- A Git repository root
|
||||
- An Insomnia export file
|
||||
- A directory containing Insomnia data
|
||||
|
||||
Examples:
|
||||
1. Using a (legacy) Git repository:
|
||||
$ inso run collection --workingDir /path/to/git-repo
|
||||
|
||||
2. Using an Insomnia export file or inside a Git project:
|
||||
$ inso run collection --workingDir /path/to/insomnia-file.yaml
|
||||
|
||||
3. Using a directory with Insomnia app data:
|
||||
$ inso run collection --workingDir /path/to/insomnia-data
|
||||
|
||||
Re-run with "--verbose" for more details.`,
|
||||
);
|
||||
|
||||
return emptyDb();
|
||||
|
||||
Reference in New Issue
Block a user