Skip to content

Commit 3298613

Browse files
Merge pull request #282 from skyflowapi/public-release/1.24.0
Release/24.9.2 For Error message changes
2 parents 3154b75 + ee5b71c commit 3298613

23 files changed

Lines changed: 259 additions & 307 deletions

Skyflow.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |spec|
22

33
spec.name = "Skyflow"
44

5-
spec.version = "1.23.0"
5+
spec.version = "1.24.0"
66

77
spec.summary = "skyflow-iOS"
88

@@ -20,7 +20,7 @@ Pod::Spec.new do |spec|
2020

2121
spec.ios.deployment_target = "9.0"
2222

23-
spec.source = { :git => "https://github.com/skyflowapi/skyflow-iOS.git", :tag => "1.23.0" }
23+
spec.source = { :git => "https://github.com/skyflowapi/skyflow-iOS.git", :tag => "1.24.0" }
2424

2525
spec.source_files = "Sources/Skyflow/**/*.{swift}"
2626

Sources/Skyflow/Version.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,6 @@
1111

1212
import Foundation
1313

14-
var SDK_VERSION = "1.23.0"
14+
var LangAndVersion = "iOS SDK v\(SDK_VERSION)"
15+
16+
var SDK_VERSION = "1.24.0"

Sources/Skyflow/collect/CollectContainer.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public extension Container {
7272
errorCode = .EMPTY_RECORDS_OBJECT()
7373
return callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions))
7474
}
75-
for record in additionalFieldEntries {
76-
errorCode = checkRecord(record: record)
75+
for (index, record) in additionalFieldEntries.enumerated() {
76+
errorCode = checkRecord(record: record, index: index)
7777
if errorCode != nil {
7878
return callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions))
7979
}
@@ -105,10 +105,10 @@ public extension Container {
105105

106106
private func checkElement(element: TextField) -> ErrorCodes? {
107107
if element.collectInput.table.isEmpty {
108-
return .EMPTY_TABLE_NAME_IN_COLLECT(value: element.collectInput.type?.name ?? element.fieldType.name)
108+
return .EMPTY_TABLE_NAME_IN_COLLECT()
109109
}
110110
if element.collectInput.column.isEmpty {
111-
return .EMPTY_COLUMN_NAME_IN_COLLECT(value: element.collectInput.type?.name ?? element.fieldType.name)
111+
return .EMPTY_COLUMN_NAME_IN_COLLECT()
112112
}
113113
if !element.isMounted() {
114114
return .UNMOUNTED_COLLECT_ELEMENT(value: element.collectInput.column)
@@ -117,25 +117,25 @@ public extension Container {
117117
return nil
118118
}
119119

120-
private func checkRecord(record: [String: Any]) -> ErrorCodes? {
120+
private func checkRecord(record: [String: Any], index: Int) -> ErrorCodes? {
121121
if record["table"] == nil {
122-
return .TABLE_KEY_ERROR()
122+
return .TABLE_KEY_ERROR(value: "\(index)")
123123
}
124124
if !(record["table"] is String) {
125-
return .INVALID_TABLE_NAME_TYPE()
125+
return .INVALID_TABLE_NAME_TYPE(value: "\(index)")
126126
}
127127
if (record["table"] as? String == "") {
128128
return .EMPTY_TABLE_NAME()
129129
}
130130
if record["fields"] == nil {
131-
return .FIELDS_KEY_ERROR()
131+
return .FIELDS_KEY_ERROR(value: "\(index)")
132132
}
133133
if !(record["fields"] is [String: Any]) {
134-
return .INVALID_FIELDS_TYPE()
134+
return .INVALID_FIELDS_TYPE(value: "\(index)")
135135
}
136136
let fields = record["fields"] as! [String: Any]
137137
if (fields.isEmpty){
138-
return .EMPTY_FIELDS_KEY()
138+
return .EMPTY_FIELDS_KEY(value: "\(index)")
139139
}
140140

141141
return nil

Sources/Skyflow/collect/CollectRequestBody.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ internal class CollectRequestBody {
2121
let tableSetEntry = tableName + "-" + (prefix == "" ? key : prefix + "." + key)
2222
if tableSet.contains(tableSetEntry) {
2323
if !self.breakFlag {
24-
self.callback?.onFailure(ErrorCodes.DUPLICATE_ADDITIONAL_FIELD_FOUND(values: [tableName, key]).getErrorObject(contextOptions: contextOptions))
24+
self.callback?.onFailure(ErrorCodes.DUPLICATE_ADDITIONAL_FIELD_FOUND(value: key).getErrorObject(contextOptions: contextOptions))
2525
self.breakFlag = true
2626
return
2727
}
@@ -43,7 +43,7 @@ internal class CollectRequestBody {
4343
mergedDict[keyPath: keypath] = val
4444
} else {
4545
if !self.breakFlag {
46-
self.callback?.onFailure(ErrorCodes.DUPLICATE_ADDITIONAL_FIELD_FOUND(values: [tableName, key]).getErrorObject(contextOptions: contextOptions))
46+
self.callback?.onFailure(ErrorCodes.DUPLICATE_ADDITIONAL_FIELD_FOUND(value: key).getErrorObject(contextOptions: contextOptions))
4747
self.breakFlag = true
4848
return
4949
}
@@ -107,7 +107,7 @@ internal class CollectRequestBody {
107107
}
108108
if(!hasElementValueMatchRule)
109109
{
110-
self.callback?.onFailure(ErrorCodes.DUPLICATE_ELEMENT_FOUND(values: [element.tableName!, element.columnName]).getErrorObject(contextOptions: contextOptions))
110+
self.callback?.onFailure(ErrorCodes.DUPLICATE_ELEMENT_FOUND(values: [ element.columnName, element.tableName!]).getErrorObject(contextOptions: contextOptions))
111111
return nil
112112
}
113113
continue;

Sources/Skyflow/collect/ICOptions.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ internal struct ICOptions {
3434
return true
3535
}
3636

37-
for currUpsertOption in self.upsert ?? [[:]]{
37+
for (index, currUpsertOption) in (self.upsert ?? [[:]]).enumerated() {
3838
if currUpsertOption["table"] == nil {
39-
let errorCode = ErrorCodes.MISSING_TABLE_NAME_IN_USERT_OPTION()
39+
let errorCode = ErrorCodes.MISSING_TABLE_NAME_IN_USERT_OPTION(value: "\(index)")
4040
self.callback!.onFailure(errorCode.getErrorObject(contextOptions: self.contextOptions!))
4141
return true
4242
}
4343
if currUpsertOption["column"] == nil {
44-
let errorCode = ErrorCodes.MISSING_COLUMN_NAME_IN_USERT_OPTION()
44+
let errorCode = ErrorCodes.MISSING_COLUMN_NAME_IN_USERT_OPTION(value: "\(index)")
4545
self.callback!.onFailure(errorCode.getErrorObject(contextOptions: self.contextOptions!))
4646
return true
4747
}
4848

4949
if currUpsertOption["table"] as! String == "" {
50-
let errorCode = ErrorCodes.TABLE_NAME_IS_EMPTY_FOR_ATLEAST_ONE_UPSERT_OPTION()
50+
let errorCode = ErrorCodes.TABLE_NAME_IS_EMPTY_FOR_ATLEAST_ONE_UPSERT_OPTION(value: "\(index)")
5151
self.callback!.onFailure(errorCode.getErrorObject(contextOptions: self.contextOptions!))
5252
return true
5353
}
5454
if currUpsertOption["column"] as! String == "" {
55-
let errorCode = ErrorCodes.COLUMN_NAME_IS_EMPTY_FOR_ATLEAST_ONE_UPSERT_OPTION()
55+
let errorCode = ErrorCodes.COLUMN_NAME_IS_EMPTY_FOR_ATLEAST_ONE_UPSERT_OPTION(value: "\(index)")
5656
self.callback!.onFailure(errorCode.getErrorObject(contextOptions: self.contextOptions!))
5757
return true
5858
}

Sources/Skyflow/composable/ComposableContainer.swift

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,17 @@ public extension Container {
186186

187187
if let options = containerOptions {
188188
if (options.layout.count == 0) {
189-
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "Interface: \(tempContextOptions.interface.description) - \(ErrorCodes.EMPTY_COMPOSABLE_LAYOUT_ARRAY().description)" ])
189+
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "\(ErrorCodes.EMPTY_COMPOSABLE_LAYOUT_ARRAY().description)" ])
190190
}
191191

192192
for i in 0..<(options.layout.count) {
193193
totalCount += (options.layout[i])
194194
}
195195
} else {
196-
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "Interface: \(tempContextOptions.interface.description) - \(ErrorCodes.MISSING_COMPOSABLE_CONTAINER_OPTIONS().description)" ])
196+
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "\(ErrorCodes.MISSING_COMPOSABLE_CONTAINER_OPTIONS().description)" ])
197197
}
198198
if (elements.count < totalCount || totalCount < elements.count){
199-
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "Interface: \(tempContextOptions.interface.description) - \(ErrorCodes.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM().description)" ])
199+
throw SkyflowError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: "\(ErrorCodes.MISMATCH_ELEMENT_COUNT_LAYOUT_SUM().description)" ])
200200
}
201201

202202
let view = createDynamicViews(layout: (containerOptions?.layout)!)
@@ -256,8 +256,8 @@ public extension Container {
256256
errorCode = .EMPTY_RECORDS_OBJECT()
257257
return callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions))
258258
}
259-
for record in additionalFieldEntries {
260-
errorCode = checkRecord(record: record)
259+
for (index, record) in additionalFieldEntries.enumerated() {
260+
errorCode = checkRecord(record: record, index: index)
261261
if errorCode != nil {
262262
return callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions))
263263
}
@@ -289,10 +289,10 @@ public extension Container {
289289

290290
private func checkElement(element: TextField) -> ErrorCodes? {
291291
if element.collectInput.table.isEmpty {
292-
return .EMPTY_TABLE_NAME_IN_COLLECT(value: element.collectInput.type?.name ?? "composable element")
292+
return .EMPTY_TABLE_NAME_IN_COLLECT()
293293
}
294294
if element.collectInput.column.isEmpty {
295-
return .EMPTY_COLUMN_NAME_IN_COLLECT(value: element.collectInput.type?.name ?? "composable element")
295+
return .EMPTY_COLUMN_NAME_IN_COLLECT()
296296
}
297297
if !element.isMounted() {
298298
return .UNMOUNTED_COLLECT_ELEMENT(value: element.collectInput.column)
@@ -301,25 +301,25 @@ public extension Container {
301301
return nil
302302
}
303303

304-
private func checkRecord(record: [String: Any]) -> ErrorCodes? {
304+
private func checkRecord(record: [String: Any], index: Int) -> ErrorCodes? {
305305
if record["table"] == nil {
306-
return .TABLE_KEY_ERROR()
306+
return .TABLE_KEY_ERROR(value: "\(index)")
307307
}
308308
if !(record["table"] is String) {
309-
return .INVALID_TABLE_NAME_TYPE()
309+
return .INVALID_TABLE_NAME_TYPE(value: "\(index)")
310310
}
311311
if (record["table"] as? String == "") {
312312
return .EMPTY_TABLE_NAME()
313313
}
314314
if record["fields"] == nil {
315-
return .FIELDS_KEY_ERROR()
315+
return .FIELDS_KEY_ERROR(value: "\(index)")
316316
}
317317
if !(record["fields"] is [String: Any]) {
318-
return .INVALID_FIELDS_TYPE()
318+
return .INVALID_FIELDS_TYPE(value: "\(index)")
319319
}
320320
let fields = record["fields"] as! [String: Any]
321321
if (fields.isEmpty){
322-
return .EMPTY_FIELDS_KEY()
322+
return .EMPTY_FIELDS_KEY(value: "\(index)")
323323
}
324324

325325
return nil

0 commit comments

Comments
 (0)