@@ -37,7 +37,6 @@ public extension DataConnectError {
3737/// Type erased DataConnectError
3838@available ( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
3939public struct AnyDataConnectError : DataConnectError {
40-
4140 private let dataConnectError : DataConnectError
4241
4342 init < E: DataConnectError > ( dataConnectError: E ) {
@@ -72,20 +71,17 @@ public extension DataConnectDomainError {
7271 }
7372}
7473
75-
7674/// Error code within an error domain
7775@available ( iOS 15 . 0 , macOS 12 . 0 , tvOS 15 . 0 , watchOS 8 . 0 , * )
78- public protocol DataConnectErrorCode : CustomStringConvertible , Equatable , Sendable , CaseIterable { }
76+ public protocol DataConnectErrorCode : CustomStringConvertible , Equatable , Sendable , CaseIterable { }
7977
8078// MARK: Data Connect Initialization Errors
8179
8280/// Error initializing Data Connect
8381public struct DataConnectInitError : DataConnectDomainError {
84-
8582 public struct Code : DataConnectErrorCode {
8683 private let code : String
87- private init ( _ code: String ) { self . code = code }
88-
84+ private init ( _ code: String ) { self . code = code }
8985
9086 public static let appNotConfigured = Code ( " appNotConfigured " )
9187 public static let grpcNotConfigured = Code ( " grpcNotConfigured " )
@@ -109,11 +105,13 @@ public struct DataConnectInitError: DataConnectDomainError {
109105 self . message = message
110106 }
111107
112- static func appNotConfigured( message: String ? = nil , cause: Error ? = nil ) -> DataConnectInitError {
108+ static func appNotConfigured( message: String ? = nil ,
109+ cause: Error ? = nil ) -> DataConnectInitError {
113110 return DataConnectInitError ( code: . appNotConfigured, message: message, cause: cause)
114111 }
115112
116- static func grpcNotConfigured( message: String ? = nil , cause: Error ? = nil ) -> DataConnectInitError {
113+ static func grpcNotConfigured( message: String ? = nil ,
114+ cause: Error ? = nil ) -> DataConnectInitError {
117115 return DataConnectInitError ( code: . grpcNotConfigured, message: message, cause: cause)
118116 }
119117}
@@ -139,7 +137,7 @@ public struct DataConnectCodecError: DataConnectDomainError {
139137 decodingFailed,
140138 invalidUUID,
141139 invalidTimestampFormat,
142- invalidLocalDateFormat
140+ invalidLocalDateFormat,
143141 ]
144142 }
145143
@@ -162,25 +160,25 @@ public struct DataConnectCodecError: DataConnectDomainError {
162160 return DataConnectCodecError ( code: . encodingFailed, message: message, cause: cause)
163161 }
164162
165- static func decodingFailed( message: String ? = nil , cause: Error ? = nil ) -> DataConnectCodecError {
166- return DataConnectCodecError ( code: . decodingFailed, message: message, cause: cause)
167- }
163+ static func decodingFailed( message: String ? = nil , cause: Error ? = nil ) -> DataConnectCodecError {
164+ return DataConnectCodecError ( code: . decodingFailed, message: message, cause: cause)
165+ }
168166
169167 static func invalidUUID( message: String ? = nil , cause: Error ? = nil ) -> DataConnectCodecError {
170168 return DataConnectCodecError ( code: . invalidUUID, message: message, cause: cause)
171169 }
172170
173- static func invalidTimestampFormat( message: String ? = nil , cause: Error ? = nil ) -> DataConnectCodecError {
171+ static func invalidTimestampFormat( message: String ? = nil ,
172+ cause: Error ? = nil ) -> DataConnectCodecError {
174173 return DataConnectCodecError ( code: . invalidTimestampFormat, message: message, cause: cause)
175174 }
176175
177- static func invalidLocalDateFormat( message: String ? = nil , cause: Error ? = nil ) -> DataConnectCodecError {
176+ static func invalidLocalDateFormat( message: String ? = nil ,
177+ cause: Error ? = nil ) -> DataConnectCodecError {
178178 return DataConnectCodecError ( code: . invalidLocalDateFormat, message: message, cause: cause)
179179 }
180-
181180}
182181
183-
184182// MARK: Operation Execution Error including Partial Errors
185183
186184/// Data Connect Operation Failed
@@ -200,17 +198,17 @@ public struct DataConnectOperationError: DataConnectError {
200198 self . message = message
201199 }
202200
203- static func executionFailed( message: String ? = nil , cause: Error ? = nil , response: OperationFailureResponse ? = nil ) -> DataConnectOperationError {
201+ static func executionFailed( message: String ? = nil , cause: Error ? = nil ,
202+ response: OperationFailureResponse ? = nil )
203+ -> DataConnectOperationError {
204204 return DataConnectOperationError ( message: message, cause: cause, response: response)
205205 }
206-
207206}
208207
209-
210208// The data and errors sent to us from the backend in its response.
211209// New struct, that contains the data and errors sent to us
212210// from the backend in its response.
213- public struct OperationFailureResponse : Sendable {
211+ public struct OperationFailureResponse : Sendable {
214212 // JSON string whose value is the "data" property provided by the backend in
215213 // its response payload; may be `nil` if the "data" property was not provided
216214 // in the backend response and/or was `null` in the backend response.
@@ -237,11 +235,9 @@ public struct OperationFailureResponse : Sendable {
237235 return data as? Data
238236 }
239237
240- internal init (
241- rawJsonData: String ? = nil ,
242- errors: [ ErrorInfo ] ,
243- data: Sendable ?
244- ) {
238+ init ( rawJsonData: String ? = nil ,
239+ errors: [ ErrorInfo ] ,
240+ data: Sendable ? ) {
245241 self . rawJsonData = rawJsonData
246242 self . errors = errors
247243 self . data = data
@@ -258,7 +254,6 @@ public struct OperationFailureResponse : Sendable {
258254 case listIndex( Int )
259255 }
260256 }
261-
262257}
263258
264259// Information about an error provided by the backend in its response.
@@ -281,9 +276,9 @@ public extension OperationFailureResponse.ErrorInfo.PathSegment {
281276 func encode( to encoder: any Encoder ) throws {
282277 var container = encoder. singleValueContainer ( )
283278 switch self {
284- case . field( let fieldVal) :
279+ case let . field( fieldVal) :
285280 try container. encode ( fieldVal)
286- case . listIndex( let indexVal) :
281+ case let . listIndex( indexVal) :
287282 try container. encode ( indexVal)
288283 }
289284 }
0 commit comments