#nullable enable using System; namespace Swan.Net.Dns { /// /// An exception thrown when the DNS query fails. /// /// [Serializable] public class DnsQueryException : Exception { internal DnsQueryException(String message) : base(message) { } internal DnsQueryException(String message, Exception e) : base(message, e) { } internal DnsQueryException(DnsClient.IDnsResponse response) : this(response, Format(response)) { } internal DnsQueryException(DnsClient.IDnsResponse response, String message) : base(message) => this.Response = response; internal DnsClient.IDnsResponse? Response { get; } private static String Format(DnsClient.IDnsResponse response) => $"Invalid response received with code {response.ResponseCode}"; } }