generated from cloudoperators/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
Description
Task Description
Refactor ComponentVersion entity error handling to implement Google-style structured error pattern, following the proven approach from the completed Issue and ComponentInstance entity refactorings.
Acceptance Criteria
Application Layer (/internal/app/component_version/)
- Refactor
ListComponentVersions()method with structured error handling - Refactor
CreateComponentVersion()method with structured error handling - Refactor
UpdateComponentVersion()method with structured error handling - Refactor
DeleteComponentVersion()method with structured error handling
Database Layer (/internal/database/mariadb/)
- Refactor
GetComponentVersions()method with structured error handling - Refactor
GetAllComponentVersionIds()method with structured error handling - Refactor
GetAllComponentVersionCursors()method with structured error handling - Refactor
CountComponentVersions()method with structured error handling - Refactor
CreateComponentVersion()method with structured error handling - Refactor
UpdateComponentVersion()method with structured error handling - Refactor
DeleteComponentVersion()method with structured error handling
API Layer (/internal/api/graphql/graph/baseResolver/)
- Refactor
SingleComponentVersionBaseResolver()method with structured error handling - Refactor
ComponentVersionBaseResolver()method with structured error handling - Replace
NewResolverError()calls with proper error handling and propagation - Ensure structured errors are properly converted to GraphQL errors
Implementation Requirements
- Replace
NewComponentVersionHandlerError()withappErrors.E()constructor - Use
appErrors.Op()for operation context tracking - Implement proper error codes (
InvalidArgument,NotFound,Internal) - Add contextual logging with
logrus.Fields - Maintain comprehensive test coverage for error scenarios
- Follow patterns established in Issue and ComponentInstance entity refactorings
- Handle database-specific errors (duplicate entry, constraint violations, etc.)
- Ensure proper error propagation from database → app → API layers
Acceptance Criterias
- All tests pass after refactoring
- Zero compilation errors (BLOCKED by unrelated component_instance.go Printf formatting issue)
- Remove legacy
ComponentVersionHandlerErrortype - Consistent error message formatting across all layers