Skip to content

Conversation

@dajimenezriv-internxt
Copy link
Contributor

@dajimenezriv-internxt dajimenezriv-internxt commented Nov 4, 2025

What

  1. Replace file handlers in dehydrate_file and hydrate_file with our custom file handler Placeholders::OpenFileHandle.
  2. Change connect_sync_root and disconnect_sync_root error handling to throw an error using winrt::check_hresult instead of returning an error.
  3. Replace handleForPath with our custom file handler Placeholders::OpenFileHandle.

@dajimenezriv-internxt dajimenezriv-internxt self-assigned this Nov 4, 2025
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 4, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud


CF_CONNECTION_KEY connectionKey;
HRESULT hr = SyncRoot::ConnectSyncRoot(syncRootPath.c_str(), callbacks, env, &connectionKey);
SyncRoot::ConnectSyncRoot(syncRootPath.c_str(), callbacks, env);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the possible error that this function may return no longer being handled?

auto [syncRootPath] = napi_extract_args<std::wstring>(env, info);

HRESULT result = SyncRoot::DisconnectSyncRoot(syncRootPath.c_str());
SyncRoot::DisconnectSyncRoot(syncRootPath.c_str());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it not necessary to handle the error here?

Comment on lines 39 to +41
HRESULT hr = CfDisconnectSyncRoot(it->second);
if (SUCCEEDED(hr))
{
connectionMap.erase(it);
}
return hr;

winrt::check_hresult(hr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the variable hr?, why not do it as in previous revisions?
winrt::check_hresult(CfDisconnectSyncRoot(it->second));

Comment on lines 22 to +29
HRESULT hr = CfConnectSyncRoot(
syncRootPath,
callbackTable,
nullptr,
CF_CONNECT_FLAG_REQUIRE_PROCESS_INFO | CF_CONNECT_FLAG_REQUIRE_FULL_FILE_PATH,
connectionKey);

wprintf(L"Connection key: %llu\n", connectionKey->Internal);
&connectionKey);

if (SUCCEEDED(hr))
{
connectionMap[syncRootPath] = *connectionKey;
}
winrt::check_hresult(hr);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the variable hr?, why not do it as in previous revisions?

winrt::check_hresult(CfConnectSyncRoot(
    syncRootPath,
    callbackTable,
    nullptr,
    CF_CONNECT_FLAG_REQUIRE_PROCESS_INFO | CF_CONNECT_FLAG_REQUIRE_FULL_FILE_PATH,
    &connectionKey));

napi_throw_error(env, nullptr, "Failed to define properties");
return nullptr;
}
napi_define_properties(env, exports, property_count, properties);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it no longer necessary to take this error into account?

@dajimenezriv-internxt dajimenezriv-internxt merged commit 4a83c7f into master Nov 4, 2025
3 of 4 checks passed
@dajimenezriv-internxt dajimenezriv-internxt deleted the improve-connect-and-disconnect-sync-root branch November 4, 2025 17:18
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.

2 participants