коммит

This commit is contained in:
Kirill 2023-12-25 22:08:53 +04:00
parent 39e4865cc7
commit 47cf7a6743
3 changed files with 50 additions and 3 deletions

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace ProjectTractor.Exceptions
{
[Serializable]
internal class CarNotFoundException : ApplicationException
{
public CarNotFoundException(int i) : base($"Не найден объект по позиции { i}") { }
public CarNotFoundException() : base() { }
public CarNotFoundException(string message) : base(message) { }
public CarNotFoundException(string message, Exception exception) :
base(message, exception)
{ }
protected CarNotFoundException(SerializationInfo info,
StreamingContext contex) : base(info, contex) { }
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;
namespace ProjectTractor.Exceptions
{
[Serializable]
internal class StorageOverflowException : ApplicationException
{
public StorageOverflowException(int count) : base($"В наборе превышено допустимое количество: { count}") { }
public StorageOverflowException() : base() { }
public StorageOverflowException(string message) : base(message) { }
public StorageOverflowException(string message, Exception exception)
: base(message, exception) { }
protected StorageOverflowException(SerializationInfo info,
StreamingContext contex) : base(info, contex) { }
}
}

View File

@ -158,10 +158,10 @@ namespace ProjectTractor
string[] set = record[1].Split(_separatorRecords, StringSplitOptions.RemoveEmptyEntries);
foreach (string elem in set)
{
DrawningTractor? bus = elem?.CreateDrawningTractor(_separatorForObject, _pictureWidth, _pictureHeight);
if (bus != null)
DrawningTractor? tractor = elem?.CreateDrawningTractor(_separatorForObject, _pictureWidth, _pictureHeight);
if (tractor != null)
{
if (!(collection + bus))
if (!(collection + tractor))
{
return false;
}