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)) ?? ""; } } }