Skip to content

Commit dc0a395

Browse files
committed
chore: consistent error
Signed-off-by: Oleksii Kurinnyi <[email protected]>
1 parent 4879878 commit dc0a395

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

webhook/workspace/handler/validate.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
dwv2 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
2525
devfilevalidation "github.com/devfile/api/v2/pkg/validation"
2626
"github.com/devfile/devworkspace-operator/apis/controller/v1alpha1"
27+
"github.com/devfile/devworkspace-operator/controllers/controller/devworkspacerouting/solvers"
2728
"sigs.k8s.io/controller-runtime/pkg/client"
2829
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
2930
)
@@ -122,7 +123,9 @@ func (h *WebhookHandler) validateEndpoints(ctx context.Context, workspace *dwv2.
122123
if component.Container != nil {
123124
for _, endpoint := range component.Container.Endpoints {
124125
if discoverableEndpoints[endpoint.Name] {
125-
return fmt.Errorf("discoverable endpoint '%s' is already in use by workspace '%s'", endpoint.Name, otherWorkspace.Name)
126+
return &solvers.ServiceConflictError{
127+
Reason: fmt.Sprintf("discoverable endpoint '%s' is already in use by workspace '%s'", endpoint.Name, otherWorkspace.Name),
128+
}
126129
}
127130
}
128131
}

0 commit comments

Comments
 (0)