Skip to content

Commit

Permalink
propagate error code in case of client reset errors in the callback
Browse files Browse the repository at this point in the history
  • Loading branch information
nicola-cab committed Nov 17, 2023
1 parent b0b4936 commit 96cd419
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/realm/object-store/c_api/sync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ RLM_API void realm_sync_config_set_before_client_reset_handler(realm_sync_config
auto cb = [callback, userdata = SharedUserdata(userdata, FreeUserdata(userdata_free))](SharedRealm before_realm) {
realm_t r1{before_realm};
if (!callback(userdata.get(), &r1)) {
throw CallbackFailed();
throw CallbackFailed{ErrorStorage::get_thread_local()->get_and_clear_usercode_error()};
}
};
config->notify_before_client_reset = std::move(cb);
Expand All @@ -404,7 +404,7 @@ RLM_API void realm_sync_config_set_after_client_reset_handler(realm_sync_config_
realm_t r1{before_realm};
auto tsr = realm_t::thread_safe_reference(std::move(after_realm));
if (!callback(userdata.get(), &r1, &tsr, did_recover)) {
throw CallbackFailed();
throw CallbackFailed{ErrorStorage::get_thread_local()->get_and_clear_usercode_error()};
}
};
config->notify_after_client_reset = std::move(cb);
Expand Down

0 comments on commit 96cd419

Please sign in to comment.