A Core/NosSmooth.Packets/Errors/PacketEndNotExpectedError.cs => Core/NosSmooth.Packets/Errors/PacketEndNotExpectedError.cs +19 -0
@@ 0,0 1,19 @@
+//
+// PacketEndNotExpectedError.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using NosSmooth.Packets.Converters;
+using Remora.Results;
+
+namespace NosSmooth.Packets.Errors;
+
+/// <summary>
+/// The end of a packet was not expected.
+/// </summary>
+/// <param name="Converter">The type converter.</param>
+/// <param name="PropertyName">The property name.</param>
+public record PacketEndNotExpectedError(ITypeConverter Converter, string PropertyName)
+ : ResultError($"Unexpected packet end reached in {Converter.GetType()} during deserializing the property {PropertyName}");<
\ No newline at end of file
A => +17 -0
@@ 0,0 1,17 @@
//
// PacketMissingHeaderError.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using NosSmooth.Packets.Packets;
using Remora.Results;
namespace NosSmooth.Packets.Errors;
/// <summary>
/// Packet is missing header and thus cannot be serialized correctly.
/// </summary>
/// <param name="Packet">The packet that is missing header.</param>
public record PacketMissingHeaderError(IPacket Packet)
: ResultError($"The packet {Packet.GetType().FullName} is missing a header and cannot be serialized.");
\ No newline at end of file
A Core/NosSmooth.Packets/Errors/PacketParameterDeserializeError.cs => Core/NosSmooth.Packets/Errors/PacketParameterDeserializeError.cs +20 -0
@@ 0,0 1,20 @@
+//
+// PacketParameterDeserializeError.cs
+//
+// Copyright (c) František Boháček. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using NosSmooth.Packets.Converters;
+using Remora.Results;
+
+namespace NosSmooth.Packets.Errors;
+
+/// <summary>
+/// Could not deserialize one of the packet's properties.
+/// </summary>
+/// <param name="Converter">The converter that could not deserialize the parameter.</param>
+/// <param name="PropertyName">The name of the property.</param>
+/// <param name="Result">The underlying result.</param>
+public record PacketParameterDeserializeError(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