Skip to content

Commit

Permalink
Surface ruletype validation errors to user (#4989)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherias authored Nov 18, 2024
1 parent ea52b4b commit 2f26b0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/controlplane/handlers_ruletype.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (s *Server) CreateRuleType(
})
if err != nil {
if errors.Is(err, ruletypes.ErrRuleTypeInvalid) {
return nil, status.Errorf(codes.InvalidArgument, "invalid rule type definition: %s", err)
return nil, util.UserVisibleError(codes.InvalidArgument, "invalid rule type definition: %s", err)
} else if errors.Is(err, ruletypes.ErrRuleAlreadyExists) {
return nil, status.Errorf(codes.AlreadyExists, "rule type %s already exists", crt.RuleType.GetName())
}
Expand Down Expand Up @@ -219,7 +219,7 @@ func (s *Server) UpdateRuleType(
})
if err != nil {
if errors.Is(err, ruletypes.ErrRuleTypeInvalid) {
return nil, status.Errorf(codes.InvalidArgument, "invalid rule type definition: %s", err)
return nil, util.UserVisibleError(codes.InvalidArgument, "invalid rule type definition: %s", err)
} else if errors.Is(err, ruletypes.ErrRuleNotFound) {
return nil, status.Errorf(codes.NotFound, "rule type %s not found", urt.RuleType.GetName())
}
Expand Down

0 comments on commit 2f26b0e

Please sign in to comment.