Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Oct 4, 2023
1 parent 58c998c commit cce6bed
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions server/internal/usecase/interactor/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/reearth/reearthx/account/accountdomain/workspace"
"github.com/reearth/reearthx/account/accountusecase"
"github.com/reearth/reearthx/account/accountusecase/accountinteractor"
"github.com/reearth/reearthx/rerror"
)

type Policy struct {
Expand All @@ -34,12 +33,12 @@ func workspaceMemberCountEnforcer(r *repo.Container) accountinteractor.Workspace
}

policy, err := r.Policy.FindByID(ctx, *policyID)
if err != nil && !errors.Is(err, rerror.ErrNotFound) {
if err != nil {
return err
}

if policy == nil {
return nil
return errors.New("invalid policy")
}

return policy.EnforceMemberCount(ws.Members().Count() + 1)
Expand Down

0 comments on commit cce6bed

Please sign in to comment.