1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.resolver.dns;
17
18 import io.netty5.handler.codec.dns.DnsQuestion;
19
20 import java.net.InetSocketAddress;
21
22 import static java.util.Objects.requireNonNull;
23
24
25
26
27 public class DnsNameResolverException extends RuntimeException {
28
29 private static final long serialVersionUID = -8826717909627131850L;
30
31 private final InetSocketAddress remoteAddress;
32 private final DnsQuestion question;
33
34 public DnsNameResolverException(InetSocketAddress remoteAddress, DnsQuestion question, String message) {
35 super(message, null, true, false);
36 this.remoteAddress = validateRemoteAddress(remoteAddress);
37 this.question = validateQuestion(question);
38 }
39
40 public DnsNameResolverException(
41 InetSocketAddress remoteAddress, DnsQuestion question, String message, Throwable cause) {
42 super(message, cause, true, false);
43 this.remoteAddress = validateRemoteAddress(remoteAddress);
44 this.question = validateQuestion(question);
45 }
46
47 private static InetSocketAddress validateRemoteAddress(InetSocketAddress remoteAddress) {
48 return requireNonNull(remoteAddress, "remoteAddress");
49 }
50
51 private static DnsQuestion validateQuestion(DnsQuestion question) {
52 return requireNonNull(question, "question");
53 }
54
55
56
57
58 public InetSocketAddress remoteAddress() {
59 return remoteAddress;
60 }
61
62
63
64
65 public DnsQuestion question() {
66 return question;
67 }
68 }