From 2b67952e64789b40d27604ff977fa8049774904f Mon Sep 17 00:00:00 2001 From: AnnaLioness Date: Fri, 1 Dec 2023 21:36:23 +0400 Subject: [PATCH] =?UTF-8?q?7=D0=BB=D0=B0=D0=B1=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Lab1ContainersShip/ShipGenericStorage.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Lab1ContainersShip/Lab1ContainersShip/ShipGenericStorage.cs b/Lab1ContainersShip/Lab1ContainersShip/ShipGenericStorage.cs index 051eed2..37f1acd 100644 --- a/Lab1ContainersShip/Lab1ContainersShip/ShipGenericStorage.cs +++ b/Lab1ContainersShip/Lab1ContainersShip/ShipGenericStorage.cs @@ -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}"); } } }