Commit f231f5fe authored by Sorin Jianu's avatar Sorin Jianu Committed by Commit Bot

Fix cast from HRESULT to UpdateService::Result.

It is incorrect to cast from an HRESULT to a enum class. If further
error handling is needed, then additional error information
must be propagated out using a different mechanism.

Right now, a generic Result::kServiceFailed is sufficient.

Bug: 1137623
Change-Id: I0014c6e222de50af2c7854d5aa8c55c3c564db36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2472704Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Commit-Queue: Sorin Jianu <sorin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817261}
parent 015f4ebc
......@@ -345,7 +345,7 @@ void UpdateServiceOutOfProcess::UpdateAllOnSTA(StateChangeCallback state_update,
HRESULT hr = CreateUpdater(updater);
if (FAILED(hr)) {
DVLOG(2) << "Failed to create the updater interface: " << std::hex << hr;
std::move(callback).Run(static_cast<Result>(hr));
std::move(callback).Run(Result::kServiceFailed);
return;
}
......@@ -366,8 +366,8 @@ void UpdateServiceOutOfProcess::UpdateAllOnSTA(StateChangeCallback state_update,
// state of the update server is. The observer may or may not post any
// callback. Disconnecting the observer resolves this ambiguity and
// transfers the ownership of the callback back to the owner of the
// observer.]
observer->Disconnect().Run(static_cast<Result>(hr));
// observer.
observer->Disconnect().Run(Result::kServiceFailed);
return;
}
}
......@@ -381,7 +381,7 @@ void UpdateServiceOutOfProcess::UpdateOnSTA(const std::string& app_id,
HRESULT hr = CreateUpdater(updater);
if (FAILED(hr)) {
DVLOG(2) << "Failed to create the updater interface: " << std::hex << hr;
std::move(callback).Run(static_cast<Result>(hr));
std::move(callback).Run(Result::kServiceFailed);
return;
}
......@@ -392,7 +392,7 @@ void UpdateServiceOutOfProcess::UpdateOnSTA(const std::string& app_id,
DVLOG(2) << "Failed to call IUpdater::UpdateAll: " << std::hex << hr;
// See the comment in the implementation of |UpdateAllOnSTA|.
observer->Disconnect().Run(static_cast<Result>(hr));
observer->Disconnect().Run(Result::kServiceFailed);
return;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment