Skip to content

Conversation

ajanikow
Copy link
Collaborator

No description provided.

@cla-bot cla-bot bot added the cla-signed label Jul 15, 2025
@ajanikow ajanikow force-pushed the feature/unify_errors branch from f868d2b to 10e93d9 Compare July 15, 2025 09:13
@ajanikow ajanikow requested a review from Copilot July 15, 2025 10:50
Copilot

This comment was marked as outdated.

@ajanikow ajanikow force-pushed the feature/unify_errors branch from 10e93d9 to 3a33bd6 Compare July 15, 2025 14:47
@ajanikow ajanikow requested a review from Copilot July 15, 2025 14:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR unifies error handling across the codebase by consolidating duplicate error array implementations. The changes replace the custom MergedErrors type with a centralized errors.Array type and add enhanced formatting capabilities.

  • Introduces ExpandArray function and Format method for improved error handling and display
  • Removes duplicate MergedErrors implementation from shared package
  • Updates test files to use the unified error types

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/util/errors/errors_array.go Adds ExpandArray function and Format method, integrates flattening into Errors function
pkg/apis/shared/errors.go Removes MergedErrors type and migrates to use errors.Array
pkg/apis/deployment/v2alpha1/server_group_volume_test.go Updates test to use errors.Array instead of shared.MergedErrors
pkg/apis/deployment/v1/server_group_volume_test.go Updates test to use errors.Array instead of shared.MergedErrors
CHANGELOG.md Documents the feature addition
Comments suppressed due to low confidence (2)

pkg/apis/deployment/v2alpha1/server_group_volume_test.go:197

  • The error message still references 'MergedError type' but the code now uses errors.Array. Update the message to reflect the new type.
require.True(t, ok, "Is not MergedError type") 

pkg/apis/deployment/v1/server_group_volume_test.go:197

  • The error message still references 'MergedError type' but the code now uses errors.Array. Update the message to reflect the new type.
require.True(t, ok, "Is not MergedError type") 
return MergedErrors{
errors: filteredErrs,
}
return errors.Errors(filteredErrs...)
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

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

The error message format may have changed from the original MergedErrors implementation. Verify that the error format returned by errors.Errors() matches the expected format for ResourceError prefixing.

Suggested change
return errors.Errors(filteredErrs...)
if len(filteredErrs) == 1 {
return filteredErrs[0]
}
// Wrap aggregated errors in a ResourceError if necessary
return ResourceError{
Prefix: "AggregatedErrors",
Err: errors.Errors(filteredErrs...),
}

Copilot uses AI. Check for mistakes.

@ajanikow ajanikow merged commit 3014f7a into master Jul 15, 2025
3 checks passed
@ajanikow ajanikow deleted the feature/unify_errors branch July 15, 2025 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants