Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(datastore): call errorHandler in Sync operation when failure #3231

Merged
merged 1 commit into from
Sep 25, 2023

Conversation

lawmicha
Copy link
Contributor

@lawmicha lawmicha commented Sep 20, 2023

Issue #

#3028

Description

DataStore's sync operation performs paginated sync query operations for each model, in the order of the model graph. Whenever the network request fails, we should provide that information to the errorHandler for visibility. Before this change, it was calling the errorHandler only on auth signed out errors.

Similar to the discussion we had in #2532 (comment) / #3232, this PR only focuses on passing the error back to the developer. We have not improved the error handling experience by mapping it to a well defined "SyncError" type.

If we did, it would be the equivalent of the ProcessName.sync in JS.

General Checklist

  • Added new tests to cover change, if needed
  • Build succeeds with all target using Swift Package Manager
  • All unit tests pass
  • All integration tests pass
  • Security oriented best practices and standards are followed (e.g. using input sanitization, principle of least privilege, etc)
  • Documentation update for the change if required
  • PR title conforms to conventional commit style
  • New or updated tests include Given When Then inline code documentation and are named accordingly testThing_condition_expectation()
  • If breaking change, documentation/changelog update with migration instructions

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@lawmicha lawmicha marked this pull request as ready for review September 20, 2023 18:19
@lawmicha lawmicha requested a review from a team as a code owner September 20, 2023 18:19
@codecov-commenter
Copy link

Codecov Report

Merging #3231 (9534396) into main (f1b6fa1) will increase coverage by 0.15%.
Report is 1 commits behind head on main.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##             main    #3231      +/-   ##
==========================================
+ Coverage   64.60%   64.76%   +0.15%     
==========================================
  Files        1091     1091              
  Lines       37071    37073       +2     
==========================================
+ Hits        23951    24009      +58     
+ Misses      13120    13064      -56     
Flag Coverage Δ
API_plugin_unit_test 67.10% <ø> (ø)
AWSPluginsCore 69.55% <ø> (ø)
Amplify 47.84% <ø> (ø)
Analytics_plugin_unit_test 86.39% <ø> (ø)
Auth_plugin_unit_test 75.04% <ø> (-0.10%) ⬇️
CoreMLPredictions_plugin_unit_test 59.44% <ø> (ø)
DataStore_plugin_unit_test 81.07% <100.00%> (+1.03%) ⬆️
Geo_plugin_unit_test 54.06% <ø> (ø)
Logging_plugin_unit_test 63.18% <ø> (ø)
Predictions_plugin_unit_test 35.17% <ø> (ø)
PushNotifications_plugin_unit_test 69.69% <ø> (ø)
Storage_plugin_unit_test 54.10% <ø> (ø)
unit_tests 64.76% <100.00%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
...Plugin/Sync/InitialSync/InitialSyncOperation.swift 82.75% <100.00%> (+0.24%) ⬆️

... and 10 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@lawmicha lawmicha merged commit 2b7f9b6 into main Sep 25, 2023
76 checks passed
@lawmicha lawmicha deleted the fix.ds-initial-sync-error-handler branch September 25, 2023 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants