File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff line change 6
6
import Foundation
7
7
import IDNSDK
8
8
9
- enum UnicodeURLConvertError : Int {
10
- case none = 0
11
- case STD3NonLDH = 300
12
- case STD3Hyphen = 301
13
- case alreadyEncoded = 302
14
- case invalidDNSLength = 303
15
- case cicleCheck = 304
9
+ public struct UnicodeURLConvertError : Error {
10
+ public enum ConvertError : Int {
11
+ case none = 0
12
+ case STD3NonLDH = 300
13
+ case STD3Hyphen = 301
14
+ case alreadyEncoded = 302
15
+ case invalidDNSLength = 303
16
+ case cicleCheck = 304
17
+ }
18
+
19
+ public let error : ConvertError
16
20
}
17
21
18
22
public extension URL {
@@ -114,8 +118,9 @@ public extension URL {
114
118
}
115
119
}
116
120
117
- if ret != XCODE_SUCCESS {
118
- throw NSError ( domain: " kIFUnicodeURLErrorDomain " , code: Int ( ret) , userInfo: nil )
121
+ if ret != XCODE_SUCCESS,
122
+ let error = UnicodeURLConvertError . ConvertError ( rawValue: Int ( ret) ) {
123
+ throw UnicodeURLConvertError ( error: error)
119
124
}
120
125
121
126
return hostname
You can’t perform that action at this time.
0 commit comments