diff --git a/Sailboat/Sailboat/FormBoatCollection.cs b/Sailboat/Sailboat/FormBoatCollection.cs index 2570d28..fb973af 100644 --- a/Sailboat/Sailboat/FormBoatCollection.cs +++ b/Sailboat/Sailboat/FormBoatCollection.cs @@ -91,6 +91,10 @@ namespace Sailboat MessageBox.Show(ex.Message); _logger.LogWarning($"{ex.Message} в наборе {listBoxStorages.SelectedItem.ToString()}"); } + catch (ArgumentException ex) + { + MessageBox.Show(ex.Message); + } } private void buttonRemoveBoat_Click(object sender, EventArgs e) diff --git a/Sailboat/Sailboat/SetGeneric.cs b/Sailboat/Sailboat/SetGeneric.cs index 5ed07e7..1dccf14 100644 --- a/Sailboat/Sailboat/SetGeneric.cs +++ b/Sailboat/Sailboat/SetGeneric.cs @@ -56,7 +56,7 @@ namespace Sailboat.Generics throw new StorageOverflowException(_maxCount); if (equal != null && _places.Contains(boat, equal)) - return false; + throw new ArgumentException("Данный объект уже есть в коллекции"); _places.Insert(0, boat); return true; }