Skip to content

Cleanup: Extend CLI error wrapping to describe and invoke commands#3773

Open
cubaseuser123 wants to merge 3 commits into
knative:mainfrom
cubaseuser123:error-wrap-describe-invoke
Open

Cleanup: Extend CLI error wrapping to describe and invoke commands#3773
cubaseuser123 wants to merge 3 commits into
knative:mainfrom
cubaseuser123:error-wrap-describe-invoke

Conversation

@cubaseuser123
Copy link
Copy Markdown
Contributor

Following up on some of my previous work with the CLI error wrapping, I noticed that the describe and invoke commands were still returning raw library errors directly to the user, instead of using the layered wrapping pattern we have in cmd/errors.go.

For example, invoke had a hardcoded fmt.Errorf with inline help text in the command handler itself, which bypasses the centralized error definitions.

This PR cleans that up by bringing both commands up to par with build, deploy, run, and delete.

Changes made

  • Added wrapDescribeError and wrapInvokeError to cmd/errors.go
  • Replaced the inline fmt.Errorf in invoke.go with NewErrNotInitializedFromPath
  • Added ErrDescribeClusterConnection and ErrInvokeNotRunning to catch specific sentinel errors with actionable "Try this:" CLI guidance
  • Added an "invoke" case to the existing ErrNotInitialized.Error() switch statement
  • Added unit tests for both wrappers (TestDescribe_WrapsNotInitialized and TestInvoke_WrapsNotInitialized) to ensure they don't regress

Everything passes go test, go vet, and go fmt locally. Let me know if you need any adjustments!

@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 17, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cubaseuser123
Once this PR has been reviewed and has the lgtm label, please assign dprotaso for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow Bot requested review from dsimansk and jrangelramos May 17, 2026 07:43
@knative-prow knative-prow Bot added the size/L 🤖 PR changes 100-499 lines, ignoring generated files. label May 17, 2026
@knative-prow
Copy link
Copy Markdown

knative-prow Bot commented May 17, 2026

Hi @cubaseuser123. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@knative-prow knative-prow Bot added the needs-ok-to-test 🤖 Needs an org member to approve testing label May 17, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 17, 2026

Codecov Report

❌ Patch coverage is 43.82022% with 50 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.82%. Comparing base (e435a89) to head (4332790).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
cmd/errors.go 41.17% 48 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3773      +/-   ##
==========================================
- Coverage   56.95%   56.82%   -0.13%     
==========================================
  Files         181      182       +1     
  Lines       21116    21458     +342     
==========================================
+ Hits        12026    12194     +168     
- Misses       7866     8041     +175     
+ Partials     1224     1223       -1     
Flag Coverage Δ
e2e 35.69% <8.98%> (-0.13%) ⬇️
e2e go ?
e2e node 27.13% <0.00%> (-1.07%) ⬇️
e2e python ?
e2e quarkus ?
e2e springboot ?
e2e typescript ?
e2e-config-ci 28.04% <0.00%> (+10.33%) ⬆️
integration 17.13% <0.00%> (-0.17%) ⬇️
unit macos-14 45.10% <45.83%> (+0.04%) ⬆️
unit macos-latest 45.10% <45.83%> (+0.04%) ⬆️
unit ubuntu-24.04-arm 45.33% <43.82%> (+0.01%) ⬆️
unit ubuntu-latest 46.04% <45.83%> (+0.03%) ⬆️
unit windows-latest 45.14% <45.83%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-ok-to-test 🤖 Needs an org member to approve testing size/L 🤖 PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant