Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
Fix validation error message to be more specific
Browse files Browse the repository at this point in the history
Signed-off-by: Darren Shepherd <darren@acorn.io>
  • Loading branch information
ibuildthecloud committed Aug 8, 2023
1 parent cc16336 commit 0775f22
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/server/registry/apigroups/acorn/devsessions/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package devsessions

import (
"context"
"fmt"

"github.com/acorn-io/baaah/pkg/router"
apiv1 "github.com/acorn-io/runtime/pkg/apis/api.acorn.io/v1"
Expand Down Expand Up @@ -32,8 +33,8 @@ func (v *Validator) Validate(ctx context.Context, obj runtime.Object) (result fi
}

if devSession.Spec.Region != app.GetRegion() {
result = append(result, field.Invalid(field.NewPath("spec", "region"), devSession.Name,
"Region on devSession and app must match"))
result = append(result, field.Invalid(field.NewPath("spec", "region"), devSession.Spec.Region,
fmt.Sprintf("Region on devSession [%s] and app [%s] must match", devSession.Spec.Region, app.GetRegion())))
return
}

Expand Down

0 comments on commit 0775f22

Please sign in to comment.