Fix the parser check
This commit is contained in:
parent
0187c45f8e
commit
3426c801c9
|
@ -76,7 +76,7 @@ private:
|
||||||
|
|
||||||
glz::json_t json{};
|
glz::json_t json{};
|
||||||
auto ec = glz::read_json(json, response.text);
|
auto ec = glz::read_json(json, response.text);
|
||||||
if (ec != glz::error_code::parse_error && json["queryresult"]["success"].get_boolean()) {
|
if (ec == glz::error_code::none && json["queryresult"]["success"].get_boolean()) {
|
||||||
return json["queryresult"]["pods"][1]["subpods"][0]["plaintext"].get<std::string>();
|
return json["queryresult"]["pods"][1]["subpods"][0]["plaintext"].get<std::string>();
|
||||||
} else {
|
} else {
|
||||||
throw std::invalid_argument("WolframAlpha query failed");
|
throw std::invalid_argument("WolframAlpha query failed");
|
||||||
|
|
Loading…
Reference in New Issue