~ruther/NosSmooth

ref: 71f75d62e6cd62b378e55c5325c8a8f021a16598 NosSmooth/Packets/NosSmooth.PacketSerializer/Errors/AmbiguousHeaderError.cs -rw-r--r-- 1.0 KiB
71f75d62 — František Boháček fix(packets): implement IPacket in RaidBfPacket 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
//  AmbiguousHeaderError.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.Collections.Generic;
using System.Linq;
using NosSmooth.PacketSerializer.Abstractions.Attributes;
using NosSmooth.PacketSerializer.Packets;
using Remora.Results;

namespace NosSmooth.PacketSerializer.Errors;

/// <summary>
/// The header was ambiguous, there were at least two packets with the same header and source.
/// </summary>
/// <param name="Header">The packet's header.</param>
/// <param name="Source">The packet's source.</param>
/// <param name="PacketTypes">The types that were ambiguous.</param>
public record AmbiguousHeaderError(string Header, PacketSource? Source, IReadOnlyList<PacketInfo> PacketTypes)
    : ResultError($"There was more than one packet with the header {Header} in the {Source.ToString() ?? "Unknown"} source. ({string.Join(", ", PacketTypes.Select(x => x.PacketType.FullName))})");
Do not follow this link