using System; using Unosquare.Swan.Networking; namespace Unosquare.Swan.Exceptions { /// /// An exception thrown when the DNS query fails. /// /// 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}"; } }