Skip to content

Commit

Permalink
chore(): Updated Swift failure handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tyllark committed Feb 14, 2025
1 parent dbe5283 commit 41055ed
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion packages/amplify_datastore/ios/Classes/CognitoPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public class CognitoPlugin: AuthCategoryPlugin {
let returning = NativeAWSAuthCognitoSession(from: session)
continuation.resume(returning: returning)
case .failure(let error):
continuation.resume(throwing: error)
let returning = NativeAWSAuthCognitoSession(from: NativeAuthSession(isSignedIn: false))
continuation.resume(returning: returning)
}
}
}
Expand Down
13 changes: 7 additions & 6 deletions packages/amplify_datastore/ios/Classes/FlutterApiPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation
case .success(let session):
break //NoOp
case .failure(let error):
throw error
}
break //NoOp
}
return
}
}
}
Expand Down Expand Up @@ -106,7 +107,7 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation
case .success(let session):
break //NoOp
case .failure(let error):
throw error
break //NoOp
}
}
}
Expand Down Expand Up @@ -173,7 +174,7 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation
case .success(let response):
subscriptionId = response.subscriptionId
case .failure(let error):
throw error
subscriptionId = nil
}
}
}
Expand Down Expand Up @@ -240,7 +241,7 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation
case .success(let response):
continuation.resume(returning: response)
case .failure(let error):
throw error
continuation.resume(returning: NativeGraphQLResponse())
}
}
}
Expand All @@ -255,7 +256,7 @@ public class FlutterApiPlugin: APICategoryPlugin, AWSAPIAuthInformation
case .success(let response):
continuation.resume(returning: response)
case .failure(let error):
throw error
continuation.resume(returning: NativeGraphQLResponse())
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public class SwiftAmplifyDataStorePlugin: NSObject, FlutterPlugin, NativeAmplify
case .success(let session):
break //NoOp
case .failure(let error):
throw error
break //NoOp
}
}
}
Expand Down

0 comments on commit 41055ed

Please sign in to comment.