File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Sources/ObservableWebSocketClient/Model/Error Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,28 @@ import Foundation
1010/// Defines a `Codable` wrapper for `Error`.
1111public struct CodableError : Error , Codable , Equatable {
1212 public let errorType : String
13- public let message : String
13+ public let description : String
14+ public let localizedDescription : String
15+ public let domain : String
16+ public let code : Int
1417
15- public init ( _ error: Error , message : String ? = nil ) {
18+ public init ( _ error: Error ) {
1619 self . errorType = String ( reflecting: type ( of: error) )
17- self . message = message ?? error. localizedDescription
20+ self . description = ( error as NSError ) . description
21+ self . localizedDescription = ( error as NSError ) . localizedDescription
22+ self . domain = ( error as NSError ) . domain
23+ self . code = ( error as NSError ) . code
24+ }
25+
26+ internal init ( errorType: String ,
27+ description: String ,
28+ localizedDescription: String ,
29+ domain: String ,
30+ code: Int ) {
31+ self . errorType = errorType
32+ self . description = description
33+ self . localizedDescription = localizedDescription
34+ self . domain = domain
35+ self . code = code
1836 }
1937}
You can’t perform that action at this time.
0 commit comments