Skip to content

Add ToolNotFoundError for clear diagnostics when CLI tools are missing#5968

Merged
vrubezhny merged 1 commit into
redhat-developer:mainfrom
vrubezhny:fix/tool-not-found-error
Jul 18, 2026
Merged

Add ToolNotFoundError for clear diagnostics when CLI tools are missing#5968
vrubezhny merged 1 commit into
redhat-developer:mainfrom
vrubezhny:fix/tool-not-found-error

Conversation

@vrubezhny

Copy link
Copy Markdown
Contributor

When a bundled CLI tool (e.g. oc) is not found or version-mismatched, executeSyncTool would pass undefined to execFileSync, causing a silent failure caught by requireLogin()'s .catch(() => true). The Explorer would show "Cluster is not accessible" with no indication that the real issue was a missing tool binary.

  • Add ToolNotFoundError class in src/tools.ts with toolName property
  • Guard executeSyncTool in cli.ts to throw ToolNotFoundError when ToolsConfig.detect() returns undefined
  • Re-throw ToolNotFoundError in loginUtil.ts catch blocks so it propagates to callers instead of being silently swallowed
  • Add unit tests for ToolNotFoundError class (tools.test.ts)
  • Add unit tests for requireLogin() error propagation (loginUtil.test.ts)

Assisted-By: Claude Opus 4.6 [email protected]

When a bundled CLI tool (e.g. oc) is not found or version-mismatched,
executeSyncTool would pass undefined to execFileSync, causing a silent
failure caught by requireLogin()'s .catch(() => true). The Explorer
would show "Cluster is not accessible" with no indication that the
real issue was a missing tool binary.

- Add ToolNotFoundError class in src/tools.ts with toolName property
- Guard executeSyncTool in cli.ts to throw ToolNotFoundError when
  ToolsConfig.detect() returns undefined
- Re-throw ToolNotFoundError in loginUtil.ts catch blocks so it
  propagates to callers instead of being silently swallowed
- Add unit tests for ToolNotFoundError class (tools.test.ts)
- Add unit tests for requireLogin() error propagation (loginUtil.test.ts)

Signed-off-by: Victor Rubezhny <[email protected]>
Assisted-By: Claude Opus 4.6 <[email protected]>
@vrubezhny
vrubezhny force-pushed the fix/tool-not-found-error branch from fab1dc1 to aebdbec Compare July 18, 2026 00:05
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.57%. Comparing base (da60441) to head (aebdbec).
⚠️ Report is 1887 commits behind head on main.

Files with missing lines Patch % Lines
src/cli.ts 66.66% 1 Missing ⚠️
src/util/loginUtil.ts 80.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5968       +/-   ##
===========================================
+ Coverage   32.37%   50.57%   +18.20%     
===========================================
  Files          85      114       +29     
  Lines        6505    10388     +3883     
  Branches     1349     2334      +985     
===========================================
+ Hits         2106     5254     +3148     
- Misses       4399     5131      +732     
- Partials        0        3        +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vrubezhny
vrubezhny merged commit 693aa72 into redhat-developer:main Jul 18, 2026
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant