fix(json_family): Fix error in JsonFamilyTest.MGet (#3285)

* fix(json_family): Fix error in JsonFamilyTest.MGet

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): address comments

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): Change LOG(WARNING) to VLOG(2)

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* fix(json_family): Test case when jsonpathv2 is false

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

* refactor(json_family): Update VLOGs level from 2 to 1

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>

---------

Signed-off-by: Stepan Bagritsevich <bagr.stepan@gmail.com>
This commit is contained in:
Stepan Bagritsevich 2024-07-09 16:02:33 +04:00 committed by GitHub
parent 628985bed2
commit e914a5f7cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 2 deletions

View file

@ -1447,10 +1447,16 @@ io::Result<JsonPathV2, string> ParsePathV2(string_view path) {
}
if (absl::GetFlag(FLAGS_jsonpathv2)) {
return json::ParsePath(path);
auto path_result = json::ParsePath(path);
if (!path_result) {
VLOG(1) << "Invalid Json path: " << path << ' ' << path_result.error() << std::endl;
return nonstd::make_unexpected(kSyntaxErr);
}
return path_result;
}
io::Result<JsonExpression> expr_result = ParseJsonPath(path);
if (!expr_result) {
VLOG(1) << "Invalid Json path: " << path << ' ' << expr_result.error() << std::endl;
return nonstd::make_unexpected(kSyntaxErr);
}
return JsonPathV2(std::move(expr_result.value()));