From 14bf2eb26d312218a9714655e3d9fba311bd1862 Mon Sep 17 00:00:00 2001 From: Jack Kavanagh Date: Thu, 10 Oct 2024 11:55:05 +0200 Subject: [PATCH] improve cli tracing (#8053) --- packages/insomnia-inso/src/db/adapters/git-adapter.ts | 10 +++++++--- packages/insomnia-inso/src/db/index.ts | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/insomnia-inso/src/db/adapters/git-adapter.ts b/packages/insomnia-inso/src/db/adapters/git-adapter.ts index c2f3083692f..ed6114dec36 100644 --- a/packages/insomnia-inso/src/db/adapters/git-adapter.ts +++ b/packages/insomnia-inso/src/db/adapters/git-adapter.ts @@ -10,11 +10,15 @@ const gitAdapter: DbAdapter = async (dir, filterTypes) => { if (!dir) { return null; } - const workspaceFolder = path.join(dir, '.insomnia', 'Workspace'); + const insomniaFolder = path.join(dir, '.insomnia'); + let files = null; try { - await fs.promises.readdir(workspaceFolder); + files = await fs.promises.readdir(insomniaFolder); } catch (error) { - // console.error(`Failed to read "${workspaceFolder}"`, error); + if (files?.length === 0) { + console.error(`.insomnia folder found at "${insomniaFolder}" + but no files found inside. Ensure your workingDir is correct.`); + } return null; } diff --git a/packages/insomnia-inso/src/db/index.ts b/packages/insomnia-inso/src/db/index.ts index 29f858a75a7..89a34e44807 100644 --- a/packages/insomnia-inso/src/db/index.ts +++ b/packages/insomnia-inso/src/db/index.ts @@ -84,7 +84,8 @@ export const loadDb = async ({ logger.warn( `No git, app data store or Insomnia V4 export file found at path "${pathToSearch}", - re-run --verbose to see tracing information`, + --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`, ); return emptyDb();