Skip to content

Commit

Permalink
Update error types based on review feedback
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslav Dimitrov <radoslav@stacklok.com>
  • Loading branch information
rdimitrov committed Jun 20, 2024
1 parent 0a41afd commit d727e2a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/controlplane/handlers_authz.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ func (s *Server) AssignRole(ctx context.Context, req *minder.AssignRoleRequest)
if errors.Is(err, sql.ErrNoRows) {
return nil, util.UserVisibleError(codes.InvalidArgument, "target project with ID %s not found", targetProject)
}
return nil, status.Errorf(codes.Internal, "error getting project: %v", err)
return nil, status.Errorf(codes.InvalidArgument, "error getting project: %v", err)
}

// Validate the subject and email - decide if it's an invitation or a role assignment
Expand Down Expand Up @@ -674,7 +674,7 @@ func (s *Server) UpdateRole(ctx context.Context, req *minder.UpdateRoleRequest)
if a.Subject == identity.String() {
roleToDelete, err := authz.ParseRole(a.Role)
if err != nil {
return nil, util.UserVisibleError(codes.InvalidArgument, err.Error())
return nil, util.UserVisibleError(codes.Internal, err.Error())
}
if err := s.authzClient.Delete(ctx, identity.String(), roleToDelete, targetProject); err != nil {
return nil, status.Errorf(codes.Internal, "error deleting previous role assignment: %v", err)
Expand Down

0 comments on commit d727e2a

Please sign in to comment.