From 3d723b7e727957805ec809cbe86e69ba076e3f6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20Boh=C3=A1=C4=8Dek?= Date: Thu, 30 Dec 2021 00:29:38 +0100 Subject: [PATCH] feat: add possibility to add reason to PacketParameterSerializerError --- .../Errors/PacketParameterSerializerError.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Core/NosSmooth.Packets/Errors/PacketParameterSerializerError.cs b/Core/NosSmooth.Packets/Errors/PacketParameterSerializerError.cs index 85a2411..220ea3c 100644 --- a/Core/NosSmooth.Packets/Errors/PacketParameterSerializerError.cs +++ b/Core/NosSmooth.Packets/Errors/PacketParameterSerializerError.cs @@ -16,5 +16,6 @@ namespace NosSmooth.Packets.Errors; /// The converter that could not deserialize the parameter. /// The name of the property. /// The underlying result. -public record PacketParameterSerializerError(ITypeConverter Converter, string PropertyName, IResult Result) - : ResultError($"There was an error deserializing property {PropertyName} in converter {Converter.GetType().FullName}"); \ No newline at end of file +/// The reason for the error, if known. +public record PacketParameterSerializerError(ITypeConverter Converter, string PropertyName, IResult Result, string? Reason = null) + : ResultError($"There was an error deserializing property {PropertyName} in converter {Converter.GetType().FullName}{(Reason is not null ? (", reason: " + Reason) : string.Empty)}"); \ No newline at end of file -- 2.48.1