Skip to content

Commit

Permalink
improve error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bjosttveit committed Sep 1, 2023
1 parent 1588694 commit 8c04254
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public virtual void AddChild(BaseComponent child)
{
if (!this.ChildIDs.Contains(child.Id))
{
throw new ArgumentException($"Child with id {child.Id} is not defined in the child IDs of this group");
throw new ArgumentException($"Attempted to add child with id {child.Id} to group {this.Id}, but this child is not included in its list of child IDs");
}
if (this.Children.FirstOrDefault(c => c.Id == child.Id) != null)
{
throw new ArgumentException($"Child with id {child.Id} is already added to this group");
throw new ArgumentException($"Attempted to add child with id {child.Id} to group {this.Id}, but a child with this id has already added");
}
child.Parent = this;
this.Children = this.Children.Append(child);
Expand Down

0 comments on commit 8c04254

Please sign in to comment.