// // 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; using System.Collections.Generic; using System.Linq; using NosSmooth.Packets.Packets; using NosSmooth.PacketSerializer.Abstractions.Attributes; using Remora.Results; namespace NosSmooth.Packets.Errors; /// /// The header was ambiguous, there were at least two packets with the same header and source. /// /// The packet's header. /// The packet's source. /// The types that were ambiguous. public record AmbiguousHeaderError(string Header, PacketSource? Source, IReadOnlyList 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))})");