From e31decb90337d5d46240beca0824007cdd2a87bf Mon Sep 17 00:00:00 2001 From: "nicolas.barbosa" Date: Fri, 17 May 2024 18:29:01 +0200 Subject: [PATCH] =?UTF-8?q?tentative=20de=20nouvelles=20expections=20non?= =?UTF-8?q?=20d=C3=A9pr=C3=A9ci=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Exceptions/CodeIncompletException.cs | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Sources/CoreLibrary/Exceptions/CodeIncompletException.cs b/Sources/CoreLibrary/Exceptions/CodeIncompletException.cs index 5e096a5..23fecdf 100644 --- a/Sources/CoreLibrary/Exceptions/CodeIncompletException.cs +++ b/Sources/CoreLibrary/Exceptions/CodeIncompletException.cs @@ -5,9 +5,15 @@ namespace CoreLibrary.Exceptions /// /// Exception levée lorsqu'un code incomplet est ajouté à la grille. /// - [Serializable] + [DataContract] public class CodeIncompletException : Exception { + [DataMember] + public int CodeErreur { get; private set; } = 1000; + + [DataMember] + public string Details { get; private set; } = String.Empty; + // Message par défaut private const string messageDefaut = "Le code que vous essayez d'ajouter dans la grille n'est pas complet."; @@ -29,13 +35,17 @@ namespace CoreLibrary.Exceptions public CodeIncompletException(string message, Exception exception) : base(message, exception) { } - [Obsolete("This method is obsolete. Use alternative methods for data retrieval.", DiagnosticId = "SYSLIB0051")] - protected CodeIncompletException(SerializationInfo info, StreamingContext contexte) : base(info, contexte) { } + public CodeIncompletException(string message, int codeErreur, string details) : base(message) + { + CodeErreur = codeErreur; + Details = details; + } - [Obsolete("This method is obsolete. Use alternative methods for data retrieval.", DiagnosticId = "SYSLIB0051")] - public override void GetObjectData(SerializationInfo info, StreamingContext context) + protected CodeIncompletException(SerializationInfo info, StreamingContext contexte) + : base(info.GetString("Message"), null) { - base.GetObjectData(info, context); + CodeErreur = info.GetInt32(nameof(CodeErreur)); + Details = info.GetString(nameof(Details)) ?? ""; } } }