Лёвушкина Анна, ПИбд-21, лаб7 простая #14

Closed
AnnaLioness wants to merge 4 commits from лаб7 into лаб6
Showing only changes of commit 2b67952e64 - Show all commits

View File

@ -148,18 +148,18 @@ public void SaveData(string filename)
{
if (!File.Exists(filename))
{
throw new Exception("Файл не найден");
throw new FileNotFoundException("Файл не найден");
}
using (StreamReader sr = new StreamReader(filename))
{
string str = sr.ReadLine();
if (str == null || str.Length == 0)
{
throw new Exception("Нет данных для загрузки");
throw new NullReferenceException("Нет данных для загрузки");
}
if (!str.StartsWith("ShipStorage"))
{
throw new Exception("Неверный формат данных");
throw new FormatException("Неверный формат данных");
}
_shipStorages.Clear();
@ -190,7 +190,7 @@ public void SaveData(string filename)
}
catch (ApplicationException ex)
{
throw new Exception($"Ошибка добавления в коллекцию: {ex.Message}");
throw new ApplicationException($"Ошибка добавления в коллекцию: {ex.Message}");
}
}
}