-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fix wrapping errors for all pkgs #387
Conversation
Created an issue with some more thoughts for the future of Errors #400 |
WalkthroughThe changes in the Changes
Sequence Diagram(s) (Beta)sequenceDiagram
participant User
participant Error
participant WrappedError
User->>Error: Create new Error
User->>Error: Wrap existing error
Error->>WrappedError: Join errors
WrappedError-->>User: Return wrapped error
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
pkg/errors/errors.go (1)
22-32
: Consider adding more context to theError
method to explain its behavior, especially when wrapping errors or handling parameters.
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (12)
- pkg/builder/docker/errors.go (1 hunks)
- pkg/builder/errors.go (1 hunks)
- pkg/builder/kaniko/errors.go (1 hunks)
- pkg/container/errors.go (1 hunks)
- pkg/errors/errors.go (1 hunks)
- pkg/errors/errors_test.go (1 hunks)
- pkg/instance/errors.go (1 hunks)
- pkg/k8s/errors.go (1 hunks)
- pkg/knuu/errors.go (1 hunks)
- pkg/minio/errors.go (1 hunks)
- pkg/preloader/errors.go (1 hunks)
- pkg/traefik/errors.go (1 hunks)
Files not summarized due to errors (2)
- pkg/instance/errors.go: Error: Message exceeds token limit
- pkg/knuu/errors.go: Error: Message exceeds token limit
Files skipped from review due to trivial changes (3)
- pkg/builder/errors.go
- pkg/minio/errors.go
- pkg/traefik/errors.go
Additional comments not posted (19)
pkg/preloader/errors.go (2)
7-7
: The aliasing ofError
toerrors.Error
standardizes error handling across the package, aligning with the PR's objectives.
10-10
: The definition ofErrGeneratingK8sNameForPreloader
usingerrors.New
is clear and follows the new error handling pattern.pkg/builder/docker/errors.go (2)
7-7
: Standardizing theError
type across different packages enhances consistency in error handling.
10-16
: Each error is well-defined with a unique identifier and descriptive message, which improves the clarity and maintainability of error handling.pkg/errors/errors.go (2)
8-13
: TheError
struct is well-defined, encapsulating necessary fields for detailed error handling.
34-37
: TheWrap
method correctly useserrors.Join
to combine errors, aligning with the PR's objective to fix error wrapping issues.pkg/container/errors.go (2)
7-7
: Using a standardizedError
type across different modules ensures uniform error handling.
10-27
: The error messages are descriptive and the use oferrors.New
standardizes the creation of error instances.pkg/builder/kaniko/errors.go (2)
7-7
: Standardizing theError
type across packages enhances consistency in error handling.
10-32
: The error definitions are clear and consistent, improving the maintainability and clarity of error handling in the package.pkg/errors/errors_test.go (1)
11-135
: The tests are comprehensive and effectively cover the functionality of the new error handling methods, ensuring robustness.pkg/k8s/errors.go (3)
4-4
: The updated import statement correctly aligns with the new error handling strategy using theerrors
package.
7-7
: The aliasing of theError
type toerrors.Error
is appropriate and supports the objective of standardizing error handling across packages.
Line range hint
10-200
: All error declarations have been correctly updated to use theerrors.New
function, ensuring consistency in error creation and management across the package.pkg/instance/errors.go (3)
4-4
: The updated import statement correctly aligns with the new error handling strategy using theerrors
package.
7-7
: The aliasing of theError
type toerrors.Error
is appropriate and supports the objective of standardizing error handling across packages.
10-200
: All error declarations have been correctly updated to use theerrors.New
function, ensuring consistency in error creation and management across the package.pkg/knuu/errors.go (2)
7-7
: Standardized error type aliasing toerrors.Error
ensures consistency across the package.
10-207
: All error messages have been refactored to use theerrors.New
function from theerrors
package, which is a good practice for maintaining consistency and clarity in error handling. However, ensure that all error messages are descriptive and provide enough context for debugging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- pkg/errors/errors.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/errors/errors.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last comment about using errors.Is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- pkg/errors/errors.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/errors/errors.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- pkg/errors/errors.go (1 hunks)
- pkg/errors/errors_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- pkg/errors/errors.go
- pkg/errors/errors_test.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🪨
Co-authored-by: Matthew Sevey <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- pkg/errors/errors.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/errors/errors.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
pkg/errors/errors_test.go (1)
56-80
: Consider simplifying theTestError_RecursiveError
test.The test for recursive error handling uses a goroutine and channels to detect infinite recursion. While this is effective, it might be simplified by directly checking for the specific error message expected when recursion is detected, thus avoiding the complexity of channels and timeouts.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- pkg/errors/errors.go (1 hunks)
- pkg/errors/errors_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- pkg/errors/errors.go
Additional comments not posted (2)
pkg/errors/errors_test.go (2)
164-226
: Review the implementation ofTestIs
.The new test function
TestIs
is well-implemented and covers various scenarios for error comparison usingerrors.Is
. This is a good addition to ensure that the custom error type behaves as expected when compared with standard and other custom errors.
82-124
: Ensure theWrap
function useserrors.Join
as intended.The test cases in
TestError_Wrap
should verify that theWrap
function is usingerrors.Join
correctly as per the PR objectives. It's crucial to ensure that the implementation matches the intended behavior described in the linked issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
Closes #364
Summary by CodeRabbit
New Features
Tests