16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
-
+
+
-
-
+
+
-
+
-
-
+
+
-
+
-
+
|
#include "config.h"
#import "OFResolveHostFailedException.h"
#import "OFDNSQueryFailedException.h"
#import "OFString.h"
@implementation OFResolveHostFailedException
@synthesize host = _host, addressFamily = _addressFamily, error = _error;
@synthesize host = _host, addressFamily = _addressFamily;
@synthesize errorCode = _errorCode;
+ (instancetype)exceptionWithHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
error: (of_dns_resolver_error_t)error
addressFamily: (OFSocketAddressFamily)addressFamily
errorCode: (OFDNSResolverErrorCode)errorCode
{
return [[[self alloc] initWithHost: host
addressFamily: addressFamily
error: error] autorelease];
errorCode: errorCode] autorelease];
}
- (instancetype)initWithHost: (OFString *)host
addressFamily: (of_socket_address_family_t)addressFamily
error: (of_dns_resolver_error_t)error
addressFamily: (OFSocketAddressFamily)addressFamily
errorCode: (OFDNSResolverErrorCode)errorCode
{
self = [super init];
@try {
_host = [host copy];
_addressFamily = addressFamily;
_error = error;
_errorCode = errorCode;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_host release];
[super dealloc];
}
- (OFString *)description
{
return [OFString stringWithFormat:
@"The host %@ could not be resolved: %@",
_host, of_dns_resolver_error_to_string(_error)];
_host, OFDNSResolverErrorCodeDescription(_errorCode)];
}
@end
|