Cleanup: Extend CLI error wrapping to describe and invoke commands#3773
Cleanup: Extend CLI error wrapping to describe and invoke commands#3773cubaseuser123 wants to merge 3 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: cubaseuser123 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
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 Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Following up on some of my previous work with the CLI error wrapping, I noticed that the
describeandinvokecommands were still returning raw library errors directly to the user, instead of using the layered wrapping pattern we have incmd/errors.go.For example,
invokehad a hardcodedfmt.Errorfwith 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, anddelete.Changes made
wrapDescribeErrorandwrapInvokeErrortocmd/errors.gofmt.Errorfininvoke.gowithNewErrNotInitializedFromPathErrDescribeClusterConnectionandErrInvokeNotRunningto catch specific sentinel errors with actionable "Try this:" CLI guidance"invoke"case to the existingErrNotInitialized.Error()switch statementTestDescribe_WrapsNotInitializedandTestInvoke_WrapsNotInitialized) to ensure they don't regressEverything passes
go test,go vet, andgo fmtlocally. Let me know if you need any adjustments!