Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
oanatmaria committed Oct 26, 2023
1 parent e8acb04 commit e1447ff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions model/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ func (d *Diff) validateObjectTypes(objs []string, rels []*RelationKind) error {
for _, objType := range d.Removed.Objects {
_, found := lo.Find(objs, func(obj string) bool { return obj == objType })
if found {
errs = multierror.Append(errs, errors.Wrapf(derr.ErrObjectTypeInUse, "object type: %s", objType))
errs = multierror.Append(errs, errors.Wrapf(derr.ErrObjectTypeInUse, "object type [%s]", objType))
}
_, found = lo.Find(rels, func(rel *RelationKind) bool { return rel.Object == objType || rel.Subject == objType })
if found {
errs = multierror.Append(errs, errors.Wrapf(derr.ErrObjectTypeInUse, "object type: %s", objType))
errs = multierror.Append(errs, errors.Wrapf(derr.ErrObjectTypeInUse, "object type [%s]", objType))
}
}
return errs
Expand All @@ -93,7 +93,7 @@ func (d *Diff) validateRelationsTypes(relations []*RelationKind) error {
return rl.Object == objType && rl.Relation == rel
})
if found {
errs = multierror.Append(errs, errors.Wrapf(derr.ErrRelationTypeInUse, "object type: %s", objType))
errs = multierror.Append(errs, errors.Wrapf(derr.ErrRelationTypeInUse, "object type [%s], relation type [%s]", objType, rel))
}
}
}
Expand Down

0 comments on commit e1447ff

Please sign in to comment.