mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-11 13:08:58 +00:00
WIP: M-1 handler sentinel error mapping (checkpoint before branch cleanup)
Uncommitted migration work at the time of branch cleanup. Tagged as checkpoint/m1-migration-wip so the commit survives git gc --prune=now. Session context: Phase 3 Part B+C of the M-1 sentinel error migration was in progress. 38 modified files, 4 new files (errors.go + errors_test.go in internal/service/ and internal/api/handler/). Resume from this commit via 'git checkout checkpoint/m1-migration-wip'.
This commit is contained in:
@@ -1318,7 +1318,10 @@ func (m *mockProfileService) ListProfiles(_ context.Context, page, perPage int)
|
||||
}
|
||||
|
||||
func (m *mockProfileService) GetProfile(_ context.Context, id string) (*domain.CertificateProfile, error) {
|
||||
return nil, fmt.Errorf("profile not found")
|
||||
// M-1: wrap service.ErrNotFound so the handler's errToStatus choke point
|
||||
// routes this to 404 via errors.Is. The Error() message still contains
|
||||
// "not found" so any pre-migration substring assertions continue to pass.
|
||||
return nil, fmt.Errorf("%w: profile not found", service.ErrNotFound)
|
||||
}
|
||||
|
||||
func (m *mockProfileService) CreateProfile(_ context.Context, profile domain.CertificateProfile) (*domain.CertificateProfile, error) {
|
||||
@@ -1341,7 +1344,8 @@ func (m *mockAgentGroupService) ListAgentGroups(_ context.Context, page, perPage
|
||||
}
|
||||
|
||||
func (m *mockAgentGroupService) GetAgentGroup(_ context.Context, id string) (*domain.AgentGroup, error) {
|
||||
return nil, fmt.Errorf("agent group not found")
|
||||
// M-1: wrap service.ErrNotFound — see GetProfile above for rationale.
|
||||
return nil, fmt.Errorf("%w: agent group not found", service.ErrNotFound)
|
||||
}
|
||||
|
||||
func (m *mockAgentGroupService) CreateAgentGroup(_ context.Context, group domain.AgentGroup) (*domain.AgentGroup, error) {
|
||||
|
||||
Reference in New Issue
Block a user