From a2c7b26e112f2c38bdda7a0aaa547c96afdaa6d9 Mon Sep 17 00:00:00 2001 From: Liam MONCHANIN Date: Wed, 24 May 2023 11:47:12 +0200 Subject: [PATCH] essai exeption null --- notus/Biblioteque_de_Class/Database.cs | 14 +++++++------- notus/Biblioteque_de_Class/Note.cs | 12 ++++++------ notus/Biblioteque_de_Class/User.cs | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/notus/Biblioteque_de_Class/Database.cs b/notus/Biblioteque_de_Class/Database.cs index a7ae603..e6f641c 100644 --- a/notus/Biblioteque_de_Class/Database.cs +++ b/notus/Biblioteque_de_Class/Database.cs @@ -53,7 +53,7 @@ namespace Biblioteque_de_Class { if (logo.GetName() == name) { return logo.GetLogoLink(); } } - throw new Exception("No logo link found."); + throw new NullReferenceException("No logo link found."); } /// @@ -68,7 +68,7 @@ namespace Biblioteque_de_Class return user; } } - throw new Exception("No user found with this username."); + throw new NullReferenceException("No user found with this username."); } /// @@ -124,7 +124,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("User not found."); + throw new NullReferenceException("User not found."); } } @@ -154,7 +154,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("Theme not found."); + throw new NullReferenceException("Theme not found."); } } @@ -170,7 +170,7 @@ namespace Biblioteque_de_Class return theme; } } - throw new Exception("No theme found with this name."); + throw new NullReferenceException("No theme found with this name."); } /// @@ -186,7 +186,7 @@ namespace Biblioteque_de_Class return; } } - throw new Exception("Theme not found."); + throw new NullReferenceException("Theme not found."); } /// @@ -205,7 +205,7 @@ namespace Biblioteque_de_Class return; } } - throw new Exception("Theme not found."); + throw new NullReferenceException("Theme not found."); } } } \ No newline at end of file diff --git a/notus/Biblioteque_de_Class/Note.cs b/notus/Biblioteque_de_Class/Note.cs index 89f9a95..a106b11 100644 --- a/notus/Biblioteque_de_Class/Note.cs +++ b/notus/Biblioteque_de_Class/Note.cs @@ -84,7 +84,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("Image not found"); + throw new NullReferenceException("Image not found"); } } } @@ -100,7 +100,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("User is not an editor"); + throw new NullReferenceException("User is not an editor"); } } @@ -110,7 +110,7 @@ namespace Biblioteque_de_Class public void AddCollaborator(User owner, User user) { if (VerifyOwner(owner)) { Collaborators.Add(user); } - else { throw new Exception("User is not the owner"); } + else { throw new NullReferenceException("User is not the owner"); } } /// @@ -119,7 +119,7 @@ namespace Biblioteque_de_Class public void RemoveCollaborator(User owner, User user) { if (VerifyOwner(owner)) { Collaborators.Remove(user); } - else { throw new Exception("User is not the owner"); } + else { throw new NullReferenceException("User is not the owner"); } } /// @@ -128,7 +128,7 @@ namespace Biblioteque_de_Class public void AddEditor(User owner, User user) { if (VerifyOwner(owner)) { Editors.Add(user); } - else { throw new Exception("User is not the owner"); } + else { throw new NullReferenceException("User is not the owner"); } } /// @@ -137,7 +137,7 @@ namespace Biblioteque_de_Class public void RemoveEditor(User owner, User user) { if (VerifyOwner(owner)) { Editors.Remove(user); } - else { throw new Exception("User is not the owner"); } + else { throw new NullReferenceException("User is not the owner"); } } } } diff --git a/notus/Biblioteque_de_Class/User.cs b/notus/Biblioteque_de_Class/User.cs index ac9627d..a5857e4 100644 --- a/notus/Biblioteque_de_Class/User.cs +++ b/notus/Biblioteque_de_Class/User.cs @@ -126,7 +126,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("Note not found"); + throw new NullReferenceException("Note not found"); } } @@ -159,7 +159,7 @@ namespace Biblioteque_de_Class } else { - throw new Exception("Note not found"); + throw new NullReferenceException("Note not found"); } }