|
12 | 12 | //
|
13 | 13 | //===----------------------------------------------------------------------===//
|
14 | 14 |
|
15 |
| -import CAsyncDNSResolver |
16 |
| - |
17 |
| -// MARK: - Async DNS resolver errors |
18 |
| - |
19 | 15 | extension AsyncDNSResolver {
|
20 | 16 | public struct Error: Swift.Error, CustomStringConvertible {
|
21 | 17 | enum Code: Equatable, CustomStringConvertible {
|
@@ -43,7 +39,7 @@ extension AsyncDNSResolver {
|
43 | 39 | case initError(String?)
|
44 | 40 | case cancelled(String?)
|
45 | 41 | case service(String?)
|
46 |
| - case other(code: Int32, String?) |
| 42 | + case other(code: Int, String?) |
47 | 43 |
|
48 | 44 | var description: String {
|
49 | 45 | switch self {
|
@@ -107,61 +103,6 @@ extension AsyncDNSResolver {
|
107 | 103 | self.code = code
|
108 | 104 | }
|
109 | 105 |
|
110 |
| - init(code: Int32, _ description: String? = nil) { |
111 |
| - switch code { |
112 |
| - case ARES_ENODATA: |
113 |
| - self = .noData(description) |
114 |
| - case ARES_EFORMERR: |
115 |
| - self = .invalidQuery(description) |
116 |
| - case ARES_ESERVFAIL: |
117 |
| - self = .serverFailure(description) |
118 |
| - case ARES_ENOTFOUND: |
119 |
| - self = .notFound(description) |
120 |
| - case ARES_ENOTIMP: |
121 |
| - self = .notImplemented(description) |
122 |
| - case ARES_EREFUSED: |
123 |
| - self = .serverRefused(description) |
124 |
| - case ARES_EBADQUERY: |
125 |
| - self = .badQuery(description) |
126 |
| - case ARES_EBADNAME: |
127 |
| - self = .badName(description) |
128 |
| - case ARES_EBADFAMILY: |
129 |
| - self = .badFamily(description) |
130 |
| - case ARES_EBADRESP: |
131 |
| - self = .badResponse(description) |
132 |
| - case ARES_ECONNREFUSED: |
133 |
| - self = .connectionRefused(description) |
134 |
| - case ARES_ETIMEOUT: |
135 |
| - self = .timeout(description) |
136 |
| - case ARES_EOF: |
137 |
| - self = .eof(description) |
138 |
| - case ARES_EFILE: |
139 |
| - self = .fileIO(description) |
140 |
| - case ARES_ENOMEM: |
141 |
| - self = .noMemory(description) |
142 |
| - case ARES_EDESTRUCTION: |
143 |
| - self = .destruction(description) |
144 |
| - case ARES_EBADSTR: |
145 |
| - self = .badString(description) |
146 |
| - case ARES_EBADFLAGS: |
147 |
| - self = .badFlags(description) |
148 |
| - case ARES_ENONAME: |
149 |
| - self = .noName(description) |
150 |
| - case ARES_EBADHINTS: |
151 |
| - self = .badHints(description) |
152 |
| - case ARES_ENOTINITIALIZED: |
153 |
| - self = .notInitialized(description) |
154 |
| - case ARES_ELOADIPHLPAPI, ARES_EADDRGETNETWORKPARAMS: |
155 |
| - self = .initError(description) |
156 |
| - case ARES_ECANCELLED: |
157 |
| - self = .cancelled(description) |
158 |
| - case ARES_ESERVICE: |
159 |
| - self = .service(description) |
160 |
| - default: |
161 |
| - self = .other(code: code, description) |
162 |
| - } |
163 |
| - } |
164 |
| - |
165 | 106 | public var description: String {
|
166 | 107 | "\(self.code)"
|
167 | 108 | }
|
@@ -262,7 +203,7 @@ extension AsyncDNSResolver {
|
262 | 203 | .init(code: .service(description))
|
263 | 204 | }
|
264 | 205 |
|
265 |
| - public static func other(code: Int32, _ description: String? = nil) -> Error { |
| 206 | + public static func other(code: Int, _ description: String? = nil) -> Error { |
266 | 207 | .init(code: .other(code: code, description))
|
267 | 208 | }
|
268 | 209 | }
|
|
0 commit comments