Commit 3113b722 authored by Nigel Tao's avatar Nigel Tao Committed by Commit Bot

Check JSON value instead of error_code

Checking (result.error_code != JSON_NO_ERROR) is equivalent to checking
result.value (which has a base::Optional type, convertible to bool).

The error_code enum is really a private implementation detail. Callers
don't care about it (other than it being an error or no error). Removing
references (outside of //base/json) to that enum will let us more easily
modify the //base/json implementation.

Bug: 1070409
Change-Id: I54b8e787b5c1469efff77fda48d72a4d7251f7f0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2147401Reviewed-by: default avatarJia Meng <jiameng@chromium.org>
Commit-Queue: Nigel Tao <nigeltao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759060}
parent 709559a1
......@@ -66,8 +66,7 @@ void TrialGroupChecker::OnRequestComplete(
base::JSONReader::ValueWithError membership_info =
base::JSONReader::ReadAndReturnValueWithError(*response_body,
base::JSON_PARSE_RFC);
if (membership_info.error_code != base::JSONReader::JSON_NO_ERROR ||
!membership_info.value->is_dict()) {
if (!membership_info.value || !membership_info.value->is_dict()) {
std::move(callback_).Run(false);
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