This commit is contained in:
Aleksandr4350 2024-06-14 08:14:29 +04:00
parent 75c7be6da3
commit 3a938f6349
3 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ where T : class
{
throw new PositionOutOfCollectionException(position);
}
if (_collection[position] == null) throw new ObjectNotFoundException(position);
if (_collection[position] == null) throw new ObjectNotFoundException(position);//выброс1
T obj = _collection[position];
_collection[position] = null;
return obj;

View File

@ -9,7 +9,7 @@ namespace ProjectAiroplane.Exceptions;
[Serializable]
internal class ObjectNotFoundException : ApplicationException
{
public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { }
public ObjectNotFoundException(int i) : base("Не найден объект по позиции " + i) { }//обработка1
public ObjectNotFoundException() : base() { }

View File

@ -77,7 +77,7 @@ public partial class FormPlaneCollection : Form
}
}
catch (ObjectNotFoundException) { MessageBox.Show("Не удалось добавить объект");
catch (ObjectNotFoundException) { MessageBox.Show("Не удалось добавить объект");//ловлю ошибку1
}