Skip to content

Conversation

@gauron99
Copy link
Contributor

Introduced 2-layer error system:

  • Layer 1 (pkg/functions/errors.go): Technical/ library errors (short to the point)

  • Layer 2 (cmd/errors.go): CLI-friendly wrappers with examples and troubleshooting (user oriented)

  • Added new error types which now use Error() and Unwrap() for using errors.Is()/As()

  • Removed the verbosity from CMD package

/fix #3051

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 20, 2026
@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 33.05556% with 241 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.47%. Comparing base (3837e3a) to head (54f2fed).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
cmd/errors.go 29.80% 217 Missing and 2 partials ⚠️
cmd/create.go 74.19% 5 Missing and 3 partials ⚠️
cmd/run.go 0.00% 6 Missing ⚠️
cmd/deploy.go 20.00% 4 Missing ⚠️
cmd/build.go 25.00% 2 Missing and 1 partial ⚠️
cmd/list.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3375      +/-   ##
==========================================
+ Coverage   53.13%   55.47%   +2.33%     
==========================================
  Files         173      173              
  Lines       20096    20112      +16     
==========================================
+ Hits        10679    11158     +479     
+ Misses       8383     7833     -550     
- Partials     1034     1121      +87     
Flag Coverage Δ
e2e 39.60% <3.49%> (-0.04%) ⬇️
e2e go 35.37% <2.09%> (-0.05%) ⬇️
e2e node 31.12% <2.09%> (-0.09%) ⬇️
e2e python 34.90% <3.49%> (-0.03%) ⬇️
e2e quarkus 31.31% <2.09%> (-0.02%) ⬇️
e2e rust 30.73% <2.09%> (-0.04%) ⬇️
e2e springboot 29.17% <2.09%> (-0.06%) ⬇️
e2e typescript 31.28% <2.09%> (-0.04%) ⬇️
integration 18.60% <0.00%> (?)
unit macos-14 44.68% <30.06%> (-0.02%) ⬇️
unit macos-latest 44.68% <30.06%> (-0.02%) ⬇️
unit ubuntu-24.04-arm 44.81% <31.94%> (-0.02%) ⬇️
unit ubuntu-latest 45.57% <30.06%> (-0.02%) ⬇️
unit windows-latest 44.70% <30.06%> (-0.02%) ⬇️

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.

Copy link
Member

@lkingland lkingland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love this cleanup. Proper Go error patterns (Unwrap, Is etc), comand-aware messages, all the definitions centralized (quarantined?), follows the architecture proposed in the ticket well... and a significant cleanup overall.

Just a few comments below, and we need to see if those E2E failures are a flake after that.

👍🏻

Comment on lines +15 to +20
func wrapValidateError(err error, cmd string) error {
if cmd != "build" && cmd != "deploy" {
msg := fmt.Sprintf(`
Internal error during error-wrapping: specified cmd '%s' not supported`, cmd)
return fmt.Errorf("%w\n%s", err, msg)
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This returns an "internal error" for any other commandh. Maybe just pass through the original error for unsupported commands?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is being passed through there using %w as well as at the end of function when the internal error couldnt be matched -- as a fallback to simply return what was passed in.

Did you mean to get rid of this Sprintf wrapping and simply return that internal error as is?

@lkingland
Copy link
Member

/lgtm
/approve

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2026
@gauron99
Copy link
Contributor Author

/retest

@gauron99 gauron99 force-pushed the improve-error-system branch from 11f47b6 to 4826247 Compare January 22, 2026 08:26
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2026
@gauron99 gauron99 force-pushed the improve-error-system branch from 4826247 to 54f2fed Compare January 22, 2026 09:15
@gauron99
Copy link
Contributor Author

new commit to main, had to rebase

@lkingland
Copy link
Member

/lgtm
/approve
(🤞🏻 the E2Es succeed)

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 22, 2026
@knative-prow
Copy link

knative-prow bot commented Jan 22, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99, lkingland

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

The pull request process is described 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 merged commit 4f9f7b8 into knative:main Jan 22, 2026
65 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a 2 layer error typed system

2 participants