2019-12-08 21:23:54 +01:00
|
|
|
|
#nullable enable
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Swan.Net.Dns {
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An exception thrown when the DNS query fails.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <seealso cref="Exception" />
|
|
|
|
|
[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}";
|
|
|
|
|
}
|
2019-12-04 18:57:18 +01:00
|
|
|
|
}
|