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

Propagate error code in case of client reset errors in the callback #7148

Merged
merged 9 commits into from
Dec 7, 2023

Conversation

nicola-cab
Copy link
Member

@nicola-cab nicola-cab commented Nov 17, 2023

What, How & Why?

When there is an error (an exception) thrown inside user code callbacks, we usually provide some hooks for the SDKs in order to register a message for the exception just thrown and retrieve it back once core stops executing the callback.
This was done for realm_config_set_migration_function, realm_config_set_data_initialization_function and realm_config_set_should_compact_on_launch_function but not for the 2 client reset callbacks.
In this case, the code is more completed because it is embedded inside the client reset logic and the session machinery. I have drafted a possible implementation in order to propagate possible errors happening inside user code callbacks while client reset is running.

Fixes: #7098

☑️ ToDos

  • 📝 Changelog update
  • 🚦 Tests (or not relevant)
  • C-API, if public C++ API changed
  • bindgen/spec.yml, if public C++ API changed

@nicola-cab nicola-cab force-pushed the nc/fix_callback_failed_for_client_reset branch from 4011f5f to 96cd419 Compare November 17, 2023 15:56
Copy link

coveralls-official bot commented Nov 20, 2023

Pull Request Test Coverage Report for Build nicola.cabiddu_1195

  • 94 of 97 (96.91%) changed or added relevant lines in 5 files are covered.
  • 173 unchanged lines in 13 files lost coverage.
  • Overall coverage decreased (-0.05%) to 91.704%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/realm/object-store/c_api/config.cpp 3 4 75.0%
src/realm/object-store/c_api/error.cpp 6 8 75.0%
Files with Coverage Reduction New Missed Lines %
src/realm/index_string.cpp 1 87.78%
src/realm/sort_descriptor.cpp 3 93.7%
src/realm/sync/client.cpp 3 91.44%
src/realm/sync/network/network.cpp 3 89.66%
src/realm/sync/noinst/client_impl_base.cpp 3 85.37%
src/realm/table.cpp 3 90.63%
src/realm/object-store/sync/sync_manager.cpp 4 86.31%
src/realm/util/assert.hpp 4 87.1%
src/realm/sync/instruction_applier.cpp 8 70.26%
test/fuzz_group.cpp 23 56.53%
Totals Coverage Status
Change from base Build 1897: -0.05%
Covered Lines: 232143
Relevant Lines: 253145

💛 - Coveralls

src/realm/exceptions.hpp Outdated Show resolved Hide resolved
src/realm/sync/client_base.hpp Outdated Show resolved Hide resolved
src/realm/object-store/c_api/sync.cpp Outdated Show resolved Hide resolved
src/realm/sync/noinst/client_impl_base.cpp Outdated Show resolved Hide resolved
@nicola-cab nicola-cab requested a review from jbreams December 5, 2023 16:38
@nicola-cab nicola-cab force-pushed the nc/fix_callback_failed_for_client_reset branch from 9e8fe78 to 351fbf2 Compare December 5, 2023 16:55
@nicola-cab nicola-cab merged commit 3975f43 into master Dec 7, 2023
2 checks passed
@nicola-cab nicola-cab deleted the nc/fix_callback_failed_for_client_reset branch December 7, 2023 10:05
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

C-API: usercode_error missing from realm_sync_error
3 participants